From bfe8c3cc714fd122b5945ddc83b9d27ca97e26fb Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 19 Jan 2011 23:09:24 -0500 Subject: Added gui.filteredlist() shortcut function for gui.dialog('filteredlist', ...). --- modules/textadept/adeptsense.lua | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'modules/textadept/adeptsense.lua') 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 -- cgit v1.2.3