From 18d7be2d1eaaef73c56dc850a3172529726d7a34 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 29 Sep 2013 21:09:56 -0400 Subject: 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. --- modules/textadept/adeptsense.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/textadept/adeptsense.lua') 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 -- /^ ... $/ -- cgit v1.2.3