aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/args.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-02-16 11:14:49 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-02-16 11:14:49 -0500
commit5fe9eb31d789627ccbbce3250e477d3356275948 (patch)
tree1a14c9cb45b905bccdca06939bce13cc82ffe4de /core/args.lua
parent0648cd2795c1427603e642c2057cf3ffea9acf60 (diff)
Fixed bug in remote-controlled Textadept when no args were initially given.
Diffstat (limited to 'core/args.lua')
-rw-r--r--core/args.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/args.lua b/core/args.lua
index 2a2afb78..9fba09ea 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -36,11 +36,12 @@ end
-- Processes command line argument table *arg*, handling switches previously
-- defined using `args.register()` and treating unrecognized arguments as
-- filenames to open.
--- Emits an `ARG_NONE` event when no arguments are present.
+-- Emits an `ARG_NONE` event when no arguments are present unless
+-- *no_emit_arg_none* is `true`.
-- @param arg Argument table.
-- @see register
-- @see _G.events
-local function process(arg)
+local function process(arg, no_emit_arg_none)
local no_args = true
local i = 1
while i <= #arg do
@@ -55,10 +56,11 @@ local function process(arg)
end
i = i + 1
end
- if no_args then events.emit(events.ARG_NONE) end
+ if no_args and not no_emit_arg_none then events.emit(events.ARG_NONE) end
end
events.connect(events.INITIALIZED, function() if arg then process(arg) end end)
-events.connect('cmd_line', process) -- undocumented, single-instance event
+-- Undocumented, single-instance event handler for forwarding arguments.
+events.connect('cmd_line', function(arg) process(arg, true) end)
if not CURSES then
-- Shows all registered command line switches on the command line.