aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/adeptsense.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-09-29 21:09:56 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-09-29 21:09:56 -0400
commit18d7be2d1eaaef73c56dc850a3172529726d7a34 (patch)
tree3eeffd78480b6ade940532e8dc3f143304b48cb6 /modules/textadept/adeptsense.lua
parentef23e13ac57cf6a8bcb04ccce10d2e5b34feec06 (diff)
downloadtextadept-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/adeptsense.lua')
-rw-r--r--modules/textadept/adeptsense.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 4987f0cf..fc1431c9 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -807,22 +807,24 @@ end
function M.goto_ctag(sense, kind, title)
if not sense.locations[kind] then return end -- no Ctags loaded
local items = {}
- local kind = sense.ctags_kinds[kind]
+ local adeptsense_kind = sense.ctags_kinds[kind]
for kind, v in pairs(sense.locations[kind]) do
items[#items + 1] = kind:match('[^#]+$') -- symbol name
- if kind == M.FUNCTION or kind == M.FIELD then
- items[#items + 1] = kind:match('^[^#]+') -- class name
+ if adeptsense_kind == M.FUNCTION or adeptsense_kind == M.FIELD then
+ items[#items + 1] = kind:match('^[^#]*') -- class name
end
items[#items + 1] = v[1]:iconv('UTF-8', _CHARSET)..':'..v[2]
end
local columns = {'Name', 'Location'}
- if kind == M.FUNCTION or kind == M.FIELD then
+ if adeptsense_kind == M.FUNCTION or adeptsense_kind == M.FIELD then
table.insert(columns, 2, 'Class')
end
- local location = ui.filteredlist(title, columns, items, false,
- '--output-column', '3')
- if not location then return end
- local path, line = location:match('^(%a?:?[^:]+):(.+)$')
+ local button, i = ui.dialogs.filteredlist{
+ title = title, columns = columns, items = items,
+ width = CURSES and ui.size[1] - 2 or nil
+ }
+ if button ~= 1 or not i then return end
+ local path, line = items[i * #columns]:match('^(%a?:?[^:]+):(.+)$')
io.open_file(path:iconv(_CHARSET, 'UTF-8'))
if not tonumber(line) then
-- /^ ... $/