diff options
author | 2020-12-19 11:27:08 -0500 | |
---|---|---|
committer | 2020-12-19 11:27:08 -0500 | |
commit | f107c48f8fbc4ef27b2bb1d4d01420229421b885 (patch) | |
tree | a6606edcdc5e25ad926b656d94d578014871b47f /modules/textadept | |
parent | dc659bcfb7adbd9e65631507c29976d2903a3950 (diff) | |
download | textadept-f107c48f8fbc4ef27b2bb1d4d01420229421b885.tar.gz textadept-f107c48f8fbc4ef27b2bb1d4d01420229421b885.zip |
Ensure a bare `ui.find.focus()` call resets incremental and in files options.
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/find.lua | 9 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 12 |
2 files changed, 8 insertions, 13 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index 5450a02a..0e84d48f 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -127,13 +127,14 @@ end local orig_focus = M.focus --- -- Displays and focuses the Find & Replace Pane. --- @param options Optional table of options to initially set. +-- @param options Optional table of `ui.find` field options to initially set. -- @name focus function M.focus(options) local already_in_files = M.in_files - if assert_type(options, 'table/nil', 1) then - for k, v in pairs(options) do M[k] = v end - end + if not assert_type(options, 'table/nil', 1) then options = {} end + if not options.in_files then options.in_files = false end -- reset + if not options.incremental then options.incremental = false end -- reset + for k, v in pairs(options) do M[k] = v end M.replace_label_text = not M.in_files and _L['Replace:'] or _L['Filter:'] if M.in_files then if not already_in_files then repl_text = M.replace_entry_text end -- save diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 2dee4f60..1ae2d909 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -147,20 +147,14 @@ local default_menubar = { }, { title = _L['Search'], - {_L['Find'], function() - ui.find.focus{in_files = false, incremental = false} - end}, + {_L['Find'], ui.find.focus}, {_L['Find Next'], ui.find.find_next}, {_L['Find Previous'], ui.find.find_prev}, {_L['Replace'], ui.find.replace}, {_L['Replace All'], ui.find.replace_all}, - {_L['Find Incremental'], function() - ui.find.focus{in_files = false, incremental = true} - end}, + {_L['Find Incremental'], function() ui.find.focus{incremental = true} end}, SEPARATOR, - {_L['Find in Files'], function() - ui.find.focus{in_files = true, incremental = false} - end}, + {_L['Find in Files'], function() ui.find.focus{in_files = true} end}, {_L['Goto Next File Found'], function() ui.find.goto_file_found(true) end}, {_L['Goto Previous File Found'], function() ui.find.goto_file_found(false) |