From 709bfa01dceaa8caef2d697ed590066d08dd5dba Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 15 Sep 2018 20:59:46 -0700 Subject: Remove unnecessary check from action_del_char --- src/tty_interface.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3