fix: menu crash after ctrl+backspace with only one character in input field

closes #847
This commit is contained in:
tomasklaen
2024-02-20 16:17:57 +01:00
parent 2370cb4e1d
commit 35699d3004

View File

@@ -845,7 +845,7 @@ end
function Menu:search_backspace(event, word_mode) function Menu:search_backspace(event, word_mode)
local pos, old_query = #self.current.search.query, self.current.search.query local pos, old_query = #self.current.search.query, self.current.search.query
local is_palette = self.current.search_style == 'palette' 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 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 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 -- First we match all same type consecutive chars at the end