diff options
author | John Hawthorn <john@hawthorn.email> | 2018-09-15 20:59:46 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2018-09-23 13:27:27 -0700 |
commit | 709bfa01dceaa8caef2d697ed590066d08dd5dba (patch) | |
tree | 5cb9b51db6d9dcae2f1531ea66799d79b86607a5 | |
parent | eefd74331b859be14ab9fb9029f84936d01bbdfa (diff) |
Remove unnecessary check from action_del_char
-rw-r--r-- | src/tty_interface.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/tty_interface.c b/src/tty_interface.c index 435edda..395ba0d 100644 --- a/src/tty_interface.c +++ b/src/tty_interface.c @@ -142,19 +142,17 @@ static void action_emit(tty_interface_t *state) { } static void action_del_char(tty_interface_t *state) { - if (*state->search) { - size_t length = strlen(state->search); - if (state->cursor == 0) { - return; - } - size_t original_cursor = state->cursor; + size_t length = strlen(state->search); + if (state->cursor == 0) { + return; + } + size_t original_cursor = state->cursor; + state->cursor--; + while (!is_boundary(state->search[state->cursor]) && state->cursor) state->cursor--; - while (!is_boundary(state->search[state->cursor]) && state->cursor) - state->cursor--; - memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1); - } + memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1); } static void action_del_word(tty_interface_t *state) { |