From 35699d300449b51d79bb9e2397a6de540bf108df Mon Sep 17 00:00:00 2001 From: tomasklaen Date: Tue, 20 Feb 2024 16:17:57 +0100 Subject: [PATCH] fix: menu crash after `ctrl+backspace` with only one character in input field closes #847 --- src/uosc/elements/Menu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uosc/elements/Menu.lua b/src/uosc/elements/Menu.lua index 42460c6c..0112beb2 100644 --- a/src/uosc/elements/Menu.lua +++ b/src/uosc/elements/Menu.lua @@ -845,7 +845,7 @@ end function Menu:search_backspace(event, word_mode) local pos, old_query = #self.current.search.query, self.current.search.query local is_palette = self.current.search_style == 'palette' - if word_mode then + if word_mode and #old_query > 1 then local word_pat, other_pat = '[^%c%s%p]+$', '[%c%s%p]+$' local init_pat = old_query:sub(#old_query):match(word_pat) and word_pat or other_pat -- First we match all same type consecutive chars at the end