aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/lua/ta_api2
-rw-r--r--modules/textadept/find.lua9
-rw-r--r--modules/textadept/menu.lua12
3 files changed, 9 insertions, 14 deletions
diff --git a/modules/lua/ta_api b/modules/lua/ta_api
index 0c1a0918..31721d33 100644
--- a/modules/lua/ta_api
+++ b/modules/lua/ta_api
@@ -523,7 +523,7 @@ find_prev_button_text ui.find.find_prev_button_text (string, Write-only)\nThe te
first_visible_line view.first_visible_line (number)\nThe line number of the line at the top of the view.
float lexer.float (pattern)\nA pattern that matches a floating point number.
focus ui.command_entry.focus()\nOpens the command entry.
-focus ui.find.focus(options)\nDisplays and focuses the Find & Replace Pane.\n@param options Optional table of options to initially set.
+focus ui.find.focus(options)\nDisplays and focuses the Find & Replace Pane.\n@param options Optional table of `ui.find` field options to initially set.
fold lexer.fold(lexer, text, start_pos, start_line, start_level)\nDetermines fold points in a chunk of text *text* using lexer *lexer*,\nreturning a table of fold levels associated with line numbers.\n*text* starts at position *start_pos* on line number *start_line* with a\nbeginning fold level of *start_level* in the buffer.\n@param lexer The lexer to fold text with.\n@param text The text in the buffer to fold.\n@param start_pos The position in the buffer *text* starts at, counting from\n 1.\n@param start_line The line number *text* starts on, counting from 1.\n@param start_level The fold level *text* starts on.\n@return table of fold levels associated with line numbers.
fold_all view.fold_all(view, action)\nContracts, expands, or toggles all fold points, depending on *action*.\nWhen toggling, the state of the first fold point determines whether to\nexpand or contract.\n@param view A view.\n@param action The fold action to perform. Valid values are:\n * `view.FOLDACTION_CONTRACT`\n * `view.FOLDACTION_EXPAND`\n * `view.FOLDACTION_TOGGLE`
fold_by_indentation lexer.fold_by_indentation (boolean)\nWhether or not to fold based on indentation level if a lexer does not have\na folder.\nSome lexers automatically enable this option. It is disabled by default.\nThis is an alias for `lexer.property['fold.by.indentation'] = '1|0'`.
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)