Browse code

Remove unnecessary check from action_del_char

John Hawthorn authored on 16/09/2018 03:59:46
Showing 1 changed files

... ...
@@ -142,19 +142,17 @@ static void action_emit(tty_interface_t *state) {
142 142
 }
143 143
 
144 144
 static void action_del_char(tty_interface_t *state) {
145
-	if (*state->search) {
146
-		size_t length = strlen(state->search);
147
-		if (state->cursor == 0) {
148
-			return;
149
-		}
150
-		size_t original_cursor = state->cursor;
145
+	size_t length = strlen(state->search);
146
+	if (state->cursor == 0) {
147
+		return;
148
+	}
149
+	size_t original_cursor = state->cursor;
151 150
 
151
+	state->cursor--;
152
+	while (!is_boundary(state->search[state->cursor]) && state->cursor)
152 153
 		state->cursor--;
153
-		while (!is_boundary(state->search[state->cursor]) && state->cursor)
154
-			state->cursor--;
155 154
 
156
-		memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1);
157
-	}
155
+	memmove(&state->search[state->cursor], &state->search[original_cursor], length - original_cursor + 1);
158 156
 }
159 157
 
160 158
 static void action_del_word(tty_interface_t *state) {