aboutsummaryrefslogtreecommitdiff
path: root/core/init.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-12-22 21:36:09 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2008-12-22 21:36:09 -0500
commita981e9f30da8ebf9d2c082196631e5daca8cf6a7 (patch)
tree40961caca26497eeab26e98f7d297dbfa83abe73 /core/init.lua
parent3343fa2a376e0737b926b570f8cd743b2a75e693 (diff)
downloadtextadept-a981e9f30da8ebf9d2c082196631e5daca8cf6a7.tar.gz
textadept-a981e9f30da8ebf9d2c082196631e5daca8cf6a7.zip
Fixed bugs in macros and macro browser.
Diffstat (limited to 'core/init.lua')
-rw-r--r--core/init.lua19
1 files changed, 11 insertions, 8 deletions
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