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/menu.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/textadept/menu.lua') 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. -- cgit v1.2.3