From f8b17fd861de1387e8d8d1c6989e3be0f1247bc4 Mon Sep 17 00:00:00 2001 From: Amine Date: Fri, 19 Jul 2024 12:38:34 +0100 Subject: [PATCH] Fix: In vim mode dw causes deadlock #414 the filter_length should be updated on each iteration. deleting the character causes the filter value to change, but it compares against the old size. --- lib/vim.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/vim.c b/lib/vim.c index b61948c..a55f3ad 100644 --- a/lib/vim.c +++ b/lib/vim.c @@ -148,9 +148,8 @@ static void delete_char_back(struct bm_menu *menu){ static void delete_word(struct bm_menu *menu){ if(!menu->filter) return; - size_t filter_length = strlen(menu->filter); - while (menu->cursor < filter_length && !isspace(menu->filter[menu->cursor])) delete_char(menu); - while (menu->cursor < filter_length && isspace(menu->filter[menu->cursor])) delete_char(menu); + while (menu->cursor < strlen(menu->filter) && !isspace(menu->filter[menu->cursor])) delete_char(menu); + while (menu->cursor < strlen(menu->filter) && isspace(menu->filter[menu->cursor])) delete_char(menu); } static void delete_word_back(struct bm_menu *menu){