diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/find.lua | 5 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 10 |
2 files changed, 7 insertions, 8 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index 796c8434..53fb8498 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -172,7 +172,10 @@ local function find_incremental(text, next, anchor) next and 1 or -1) end buffer:goto_pos(incremental_start or 0) - find(text, next, M.match_case and buffer.FIND_MATCHCASE or 0) + -- Note: even though `events.FIND` does not support a flags parameter, the + -- default handler has one, so make use of it. + events.emit(events.FIND, text, next, + M.match_case and buffer.FIND_MATCHCASE or 0) end --- diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 2789f0b6..5f38c340 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -539,8 +539,8 @@ end) -- Prompts the user to select a menu command to run. -- @name select_command function M.select_command() - local items, commands = {}, {} - -- Builds the item and commands tables for the filtered list dialog. + local items = {} + -- Builds the item tables for the filtered list dialog. -- @param menu The menu to read from. local function build_command_tables(menu) for i = 1, #menu do @@ -550,7 +550,6 @@ function M.select_command() local label = menu.title and menu.title..': '..menu[i][1] or menu[i][1] items[#items + 1] = label:gsub('_([^_])', '%1') items[#items + 1] = key_shortcuts[tostring(menu[i][2])] or '' - commands[#commands + 1] = menu[i][2] end end end @@ -559,10 +558,7 @@ function M.select_command() title = _L['Run Command'], columns = {_L['Command'], _L['Key Binding']}, items = items, width = CURSES and ui.size[1] - 2 or nil } - if button ~= 1 or not i then return end - assert(type(commands[i]) == 'function', - _L['Unknown command:']..' '..tostring(commands[i])) - commands[i]() + if button == 1 and i then events.emit(events.MENU_CLICKED, i) end end return setmetatable(M, { |