aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/args.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-03-14 10:57:49 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-03-14 10:57:49 -0400
commitbcb277c144c4f4e18c46000e48e37e17b476239a (patch)
treeeaac673db7f8fb340ecf72a526aad52418ee4baf /core/args.lua
parent6b37358e5c6efec74c17fc1871d25aa019629f29 (diff)
Prevent -h, --help switches from exiting single instance; core/args.lua
Diffstat (limited to 'core/args.lua')
-rw-r--r--core/args.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/args.lua b/core/args.lua
index 907fd465..b1d87c64 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -72,7 +72,14 @@ local function show_help()
for k, v in pairs(switches) do print(line:format(k, table.unpack(v, 2))) end
os.exit()
end
-if not CURSES then M.register('-h', '--help', 0, show_help, 'Shows this') end
+if not CURSES then
+ M.register('-h', '--help', 0, show_help, 'Shows this')
+ -- After Textadept finishes initializing and processes arguments, remove the
+ -- help switches to prevent another instance from sending '-h' and '--help' to
+ -- the first instance, killing the latter.
+ events.connect(events.INITIALIZED,
+ function() switches['-h'], switches['--help'] = nil, nil end)
+end
-- For Windows, create arg table from single command line string (arg[0]).
if WIN32 and not CURSES and #arg[0] > 0 then