diff options
author | 2013-09-29 21:09:56 -0400 | |
---|---|---|
committer | 2013-09-29 21:09:56 -0400 | |
commit | 18d7be2d1eaaef73c56dc850a3172529726d7a34 (patch) | |
tree | 3eeffd78480b6ade940532e8dc3f143304b48cb6 /modules/textadept/find.lua | |
parent | ef23e13ac57cf6a8bcb04ccce10d2e5b34feec06 (diff) | |
download | textadept-18d7be2d1eaaef73c56dc850a3172529726d7a34.tar.gz textadept-18d7be2d1eaaef73c56dc850a3172529726d7a34.zip |
Added new `ui.dialogs` module for more user-friendly dialog support.
As a result, removed `ui.filteredlist()` and changed `io.open_file()` and
`io.snapopen()` APIs to accept tables of files and paths instead of "\n"
delimited strings.
Diffstat (limited to 'modules/textadept/find.lua')
-rw-r--r-- | modules/textadept/find.lua | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index 82b5f4c4..177e85e8 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -217,13 +217,11 @@ end -- @see FILTER -- @name find_in_files function M.find_in_files(dir) - dir = dir or ui.dialog('fileselect', - '--title', _L['Find in Files'], - '--select-only-directories', - '--with-directory', - (buffer.filename or ''):match('^.+[/\\]') or '', - '--no-newline') - if dir == '' then return end + dir = dir or ui.dialogs.fileselect{ + title = _L['Find in Files'], select_only_directories = true, + with_directory = (buffer.filename or ''):match('^.+[/\\]'), + } + if not dir then return end local text = M.find_entry_text if not M.lua then text = text:gsub('([().*+?^$%%[%]-])', '%%%1') end @@ -275,15 +273,11 @@ local function replace(rtext) buffer:replace_target(rtext:gsub('\\[abfnrtv\\]', escapes)) buffer:goto_pos(buffer.target_end) -- 'find' text after this replacement else - ui.dialog('ok-msgbox', - '--title', _L['Error'], - '--text', _L['An error occured:'], - '--informative-text', - rtext:match(':1:(.+)$') or rtext:match(':%d+:(.+)$'), - '--icon', 'gtk-dialog-error', - '--button1', _L['_OK'], - '--button2', _L['_Cancel'], - '--no-cancel') + ui.dialogs.msgbox{ + title = _L['Error'], text = _L['An error occured:'], + informative_text = rtext:match(':1:(.+)$') or rtext:match(':%d+:(.+)$'), + icon = 'gtk-dialog-error' + } -- Since find is called after replace returns, have it 'find' the current -- text again, rather than the next occurance so the user can fix the error. buffer:goto_pos(buffer.current_pos) |