From 47b8c0db856c48abbcbcb5635deaa5c2cc41427e Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 23 Feb 2008 18:13:24 -0500 Subject: Eliminated Zenity dependency; replaced with my CocoaDialog clone (lua_dialog). --- modules/textadept/macros.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'modules/textadept/macros.lua') diff --git a/modules/textadept/macros.lua b/modules/textadept/macros.lua index 1502d5d5..2514256a 100644 --- a/modules/textadept/macros.lua +++ b/modules/textadept/macros.lua @@ -66,9 +66,11 @@ function stop_recording() recording = false local textadept = textadept local bf, bp = textadept.buffer_functions, textadept.buffer_properties - local p = io.popen('zenity --entry --text "Macro name:"') - local macro_name = p:read('*all'):sub(1, -2) - p:close() + local macro_name = cocoa_dialog( 'standard-inputbox', { + title = 'Save Macro', + text = 'Macro name:', + ['no-newline'] = true + } ) if #macro_name > 0 then for _, command in ipairs(current) do @@ -84,7 +86,7 @@ function stop_recording() end end end - list[macro_name] = current + list[ macro_name:match('[^\n]+') ] = current save() textadept.statusbar_text = 'Macro saved' textadept.events.handle('macro_saved') @@ -106,11 +108,13 @@ end function play(macro_name) if not macro_name then local macro_list = '' - for name in pairs(list) do macro_list = macro_list..name..' ' end - local p = io.popen('zenity --list --text "Select a Macro" --column Name '.. - macro_list) - macro_name = p:read('*all'):sub(1, -2) - p:close() + for name in pairs(list) do macro_list = macro_list..'"'..name..'"'..' ' end + macro_name = cocoa_dialog( 'standard-dropdown', { + title = 'Select a Macro', + text = 'Macro name:', + items = macro_list, + ['no-newline'] = true + } ) end local macro = list[macro_name] if not macro then return end -- cgit v1.2.3