aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiley Beckett <rbeckettvt@gmail.com>2025-11-09 20:47:44 -0500
committerRiley Beckett <rbeckettvt@gmail.com>2025-11-09 20:47:44 -0500
commita37cd144149859399fa180080189105335675351 (patch)
tree3926703ceee71c71f0b118d207acf88ca71d4073
parentc078f5275f27a8812301a7d9c795ab4284d69bd3 (diff)
fix forward_word
-rw-r--r--keybind.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/keybind.c b/keybind.c
index 5e357fb..cb1d52d 100644
--- a/keybind.c
+++ b/keybind.c
@@ -111,15 +111,13 @@ key_repeat_t backward_char(client_state* state) {
key_repeat_t forward_word(client_state* state) {
if (state->cursor_index < array_size(state->input_buffer)) {
- bool hit_white = false;
- for (; state->cursor_index < array_size(state->input_buffer); state->cursor_index++) {
- if (state->input_buffer[state->cursor_index] == ' ') {
- hit_white = true;
- } else if (hit_white) {
- break;
- }
- }
- }
+ for (; state->cursor_index < array_size(state->input_buffer) &&
+ state->input_buffer[state->cursor_index] == ' ';
+ state->cursor_index++);
+ for (; state->cursor_index < array_size(state->input_buffer) &&
+ state->input_buffer[state->cursor_index] != ' ';
+ state->cursor_index++);
+ }
return KEY_REPEAT;
}