aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/menu.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/menu.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/menu.lua')
-rw-r--r--modules/textadept/menu.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 2f984d8a..4099cc28 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -192,10 +192,10 @@ local menubar = {
{_L['Show _LuaDoc'], {utils.open_webpage, _HOME..'/doc/api/index.html'}},
SEPARATOR,
{_L['_About'],
- {ui.dialog, 'ok-msgbox', '--title', 'Textadept', '--text', _RELEASE,
- '--informative-text', 'Copyright © 2007-2013 Mitchell. See LICENSE\n'..
- 'http://foicica.com/textadept', '--button1', _L['_OK'], '--no-cancel',
- '--icon-file', _HOME..'/core/images/ta_64x64.png'}},
+ {ui.dialogs.msgbox, {title = 'Textadept', text = _RELEASE,
+ informative_text = 'Copyright © 2007-2013 Mitchell. See LICENSE\n'..
+ 'http://foicica.com/textadept',
+ icon_file = _HOME..'/core/images/ta_64x64.png'}}},
},
}
@@ -341,10 +341,12 @@ if not CURSES then M.set_contextmenu(context_menu) end
-- Prompts the user to select a menu command to run.
-- @name select_command
function M.select_command()
- local i = ui.filteredlist(_L['Run Command'],
- {_L['Command'], _L['Key Command']}, items, true,
- CURSES and {'--width', ui.size[1] - 2} or '')
- if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
+ local button, i = ui.dialogs.filteredlist{
+ title = _L['Run Command'], columns = {_L['Command'], _L['Key Command']},
+ items = items, width = CURSES and ui.size[1] - 2 or nil
+ }
+ if button ~= 1 or not i then return end
+ keys.run_command(commands[i], type(commands[i]))
end
-- Performs the appropriate action when clicking a menu item.