diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-16 00:44:33 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-16 00:44:33 +0100 |
commit | 4db7f46808502e3a667d442d7a77f83f4593650b (patch) | |
tree | baab2f9d0a6194960f3e29694cf5e23699ea64d2 /src/parser.cpp | |
parent | 51aaeb062bf8f7e032b591832acd19901fca94c0 (diff) | |
download | sciteco-4db7f46808502e3a667d442d7a77f83f4593650b.tar.gz |
implemented ^C command
* acts like exit(3) -- ie. the program is terminated
immediately but the quit hook (aka SciTECO's atexit()
handlers) will still run.
* for "compatibility" with classic TECOs.
Can also be used as a shorter variant of "-EX$$"
but working from every macro level.
* disallowed in interactive mode to avoid typing it
accidentally.
Diffstat (limited to 'src/parser.cpp')
-rw-r--r-- | src/parser.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 3541db1..85d455c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1916,6 +1916,29 @@ StateControl::custom(gchar chr) { switch (String::toupper(chr)) { /*$ + * ^C -- Exit program immediately + * + * Lets the top-level macro return immediately + * regardless of the current macro invocation frame. + * This command is only allowed in batch mode, + * so it is not invoked accidentally when using + * the CTRL+C immediate editing command to + * interrupt long running operations. + * When using \fB^C\fP in a munged file, + * interactive mode is never started, so it behaves + * effectively just like \(lq-EX\fB$$\fP\(rq + * (when executed in the top-level macro at least). + * + * The \fBquit\fP hook is still executed. + */ + case 'C': + BEGIN_EXEC(&States::start); + if (undo.enabled) + throw Error("<^C> not allowed in interactive mode"); + quit_requested = true; + throw Quit(); + + /*$ * ^O -- Set radix to 8 (octal) */ case 'O': |