diff options
author | 2011-01-19 23:09:24 -0500 | |
---|---|---|
committer | 2011-01-19 23:09:24 -0500 | |
commit | bfe8c3cc714fd122b5945ddc83b9d27ca97e26fb (patch) | |
tree | 1fecefdf30e754580f3cf804031836e01fa3d1c7 /modules/textadept/adeptsense.lua | |
parent | 98c6ba37e86c9ef6fe52c89e02462eb72a7ae790 (diff) | |
download | textadept-bfe8c3cc714fd122b5945ddc83b9d27ca97e26fb.tar.gz textadept-bfe8c3cc714fd122b5945ddc83b9d27ca97e26fb.zip |
Added gui.filteredlist() shortcut function for gui.dialog('filteredlist', ...).
Diffstat (limited to 'modules/textadept/adeptsense.lua')
-rw-r--r-- | modules/textadept/adeptsense.lua | 35 |
1 files changed, 13 insertions, 22 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 |