aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/adeptsense.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-01-19 23:09:24 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2011-01-19 23:09:24 -0500
commitbfe8c3cc714fd122b5945ddc83b9d27ca97e26fb (patch)
tree1fecefdf30e754580f3cf804031836e01fa3d1c7 /modules/textadept/adeptsense.lua
parent98c6ba37e86c9ef6fe52c89e02462eb72a7ae790 (diff)
downloadtextadept-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.lua35
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