Skip to content

Commit

Permalink
fix: menus crash when ctrl+backspace pressed while input is empty
Browse files Browse the repository at this point in the history
Closes #745
  • Loading branch information
tomasklaen committed Oct 28, 2023
1 parent 656ddcf commit 55789e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dist/scripts/uosc/elements/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ function Menu:search_backspace(event, word_mode)
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
local tail = old_query:match(init_pat)
local tail = old_query:match(init_pat) or ''
-- If there's only one, we extend the tail with opposite type chars
if tail and #tail == 1 then
tail = tail .. old_query:sub(1, #old_query - #tail):match(init_pat == word_pat and other_pat or word_pat)
Expand Down

0 comments on commit 55789e1

Please # to comment.