From a981e9f30da8ebf9d2c082196631e5daca8cf6a7 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 22 Dec 2008 21:36:09 -0500 Subject: Fixed bugs in macros and macro browser. --- core/ext/menu.lua | 10 ++++++++++ core/init.lua | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'core') diff --git a/core/ext/menu.lua b/core/ext/menu.lua index 2b3209e6..78d706bc 100644 --- a/core/ext/menu.lua +++ b/core/ext/menu.lua @@ -111,6 +111,11 @@ t.menubar = { '_Update Multiple Lines', '_Finished Editing', }, + { title = 'M_acros', + '_Start Recording', + 'S_top Recording', + '_Play Macro' + }, }, gtkmenu { title = '_Buffers', @@ -165,6 +170,7 @@ local b, v = 'buffer', 'view' local m_snippets = _m.textadept.lsnippets local m_editing = _m.textadept.editing local m_mlines = _m.textadept.mlines +local m_macros = _m.textadept.macros local function pm_activate(text) t.pm.entry_text = text t.pm.activate() end local function toggle_setting(setting) @@ -267,6 +273,10 @@ local actions = { ['Remove Multiple Lines'] = { m_mlines.remove_multiple }, ['Update Multiple Lines'] = { m_mlines.update }, ['Finished Editing'] = { m_mlines.clear }, + -- Tools -> Macros + ['Start Recording'] = { m_macros.start_recording }, + ['Stop Recording'] = { m_macros.stop_recording }, + ['Play Macro'] = { m_macros.play }, -- Buffers ['Next Buffer'] = { 'goto_buffer', v, 1, false }, ['Prev Buffer'] = { 'goto_buffer', v, -1, false }, diff --git a/core/init.lua b/core/init.lua index 84c0d4d6..7a25169b 100644 --- a/core/init.lua +++ b/core/init.lua @@ -38,21 +38,24 @@ end -- used. -- @return string CocoaDialog result. function cocoa_dialog(kind, opts) - local args = not MAC and { kind } or '' + local args = { kind } for k, v in pairs(opts) do - if not MAC then - args[#args + 1] = '--'..k - if type(v) == 'string' then args[#args + 1] = v end - else - args = args..' --'..k - if type(v) == 'string' then args = args..' "'..v..'"' end + args[#args + 1] = '--'..k + if k == 'items' and kind:match('dropdown') then + if not MAC then + for item in v:gmatch('"(.-)"%s+') do args[#args + 1] = item end + else + args[#args + 1] = v + end + elseif type(v) == 'string' then + args[#args + 1] = not MAC and v or '"'..v..'"' end end if not MAC then return lua_dialog.run(args) else local cocoa_dialog = '/CocoaDialog.app/Contents/MacOS/CocoaDialog ' - local p = io.popen(_HOME..cocoa_dialog..kind..args) + local p = io.popen( _HOME..cocoa_dialog..table.concat(args, ' ') ) local out = p:read('*all') p:close() return out -- cgit v1.2.3