diff options
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/adeptsense.lua | 35 | ||||
-rw-r--r-- | modules/textadept/mime_types.lua | 12 | ||||
-rw-r--r-- | modules/textadept/snapopen.lua | 11 |
3 files changed, 17 insertions, 41 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua index db2332ed..132875d3 100644 --- a/modules/textadept/adeptsense.lua +++ b/modules/textadept/adeptsense.lua @@ -313,29 +313,20 @@ function goto_ctag(sense, k, title) if kind == 'functions' or kind == 'fields' then table.insert(columns, 2, 'Class') end - local out = gui.dialog('filteredlist', - '--title', title, - '--button1', 'gtk-ok', - '--button2', 'gtk-cancel', - '--no-newline', - '--string-output', - '--output-column', '3', - '--columns', columns, - '--items', items) - local response, location = out:match('([^\n]+)\n([^\n]+)$') - if response and response ~= 'gtk-cancel' then - local path, line = location:match('^([^:]+):(.+)$') - io.open_file(path) - if not tonumber(line) then - -- /^ ... $/ - buffer.target_start, buffer.target_end = 0, buffer.length - buffer.search_flags = _SCINTILLA.constants.SCFIND_REGEXP - if buffer:search_in_target(line:sub(2, -2)) >= 0 then - buffer:goto_pos(buffer.target_start) - end - else - _m.textadept.editing.goto_line(tonumber(line)) + local location = gui.filteredlist(title, columns, items, false, + '--output-column', '3') + if not location then return end + local path, line = location:match('^([^:]+):(.+)$') + io.open_file(path) + if not tonumber(line) then + -- /^ ... $/ + buffer.target_start, buffer.target_end = 0, buffer.length + buffer.search_flags = _SCINTILLA.constants.SCFIND_REGEXP + if buffer:search_in_target(line:sub(2, -2)) >= 0 then + buffer:goto_pos(buffer.target_start) end + else + _m.textadept.editing.goto_line(tonumber(line)) end end diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua index 378ce42b..eaa4302a 100644 --- a/modules/textadept/mime_types.lua +++ b/modules/textadept/mime_types.lua @@ -203,14 +203,6 @@ connect('reset_after', -- Prompts the user to select a lexer from a filtered list for the current -- buffer. function select_lexer() - local out = gui.dialog('filteredlist', - '--title', L('Select Lexer'), - '--button1', 'gtk-ok', - '--button2', 'gtk-cancel', - '--no-newline', - '--string-output', - '--columns', 'Name', - '--items', lexers) - local response, lexer = out:match('([^\n]+)\n([^\n]+)$') - if response and response ~= 'gtk-cancel' then buffer:set_lexer(lexer) end + local lexer = gui.filteredlist(L('Select Lexer'), 'Name', lexers) + if lexer then buffer:set_lexer(lexer) end end diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua index 3661f4b6..3f27c9f0 100644 --- a/modules/textadept/snapopen.lua +++ b/modules/textadept/snapopen.lua @@ -114,13 +114,6 @@ function open(paths, filter, exclusive, depth) L('files or more were found. Showing the first'),
MAX))
end
- local out = gui.dialog('filteredlist',
- '--title', L('Open'),
- '--button1', 'gtk-ok',
- '--button2', 'gtk-cancel',
- '--no-newline',
- '--columns', 'File',
- '--items', list)
- local response, index = out:match('^(%d+)[\r\n]+(%d+)')
- if response == '1' then io.open_file(list[tonumber(index) + 1]) end
+ local i = gui.filteredlist(L('Open'), 'File', list, true)
+ if i then io.open_file(list[i + 1]) end
end
|