diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-27 22:47:27 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-27 22:47:27 +0100 |
commit | 8460f925248b99e94169bbfa9f2645de677f2e27 (patch) | |
tree | d891ae50b009c64797e84ed7299d7e2d2956dc66 /src/parser.cpp | |
parent | 0fbbc0d99625e00e5a0389e28fc8dcd4160aeac2 (diff) | |
download | sciteco-8460f925248b99e94169bbfa9f2645de677f2e27.tar.gz |
fixed rubout of the first command after command line termination ($$)
* The $$ would leave the current state pointing to the "escape" state
which was manually fixed up in macro return handling but not in command line
return (ie. termination) handling.
Therefore the initial state at the start of the command line after $$
was the "escape" state.
The rubout-last-command immediate editing command would consequently
end up in an infinite loop trying to reach the start state.
* This has been fixed by setting the state before throwing Return().
Some additional paranoia assertions have been added to prevent this
bug in the future.
Diffstat (limited to 'src/parser.cpp')
-rw-r--r-- | src/parser.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index de7184a..db68c18 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -212,11 +212,8 @@ Execute::macro(const gchar *macro, bool locals) * end of macro, even though some checks * are unnecessary here. * macro_pc will still point to the return PC. - * We are still in the "escape" state and must - * reset it here, so it is not confused - * with a trailing ^[ in macro. */ - States::current = &States::start; + g_assert(States::current == &States::start); /* * Discard all braces, except the current one. @@ -252,8 +249,8 @@ Execute::macro(const gchar *macro, bool locals) * Due to the deferred nature of ^[, * it is valid to end in the "escape" state. * FIXME: This could be avoided by signalling - * the state the end of macro but State::refresh() - * cannot be used :-(. + * the state the end of macro using a new + * virtual method. */ expressions.discard_args(); } else if (G_UNLIKELY(States::current != &States::start)) { @@ -2152,6 +2149,7 @@ StateEscape::custom(gchar chr) */ if (chr == CTL_KEY_ESC) { BEGIN_EXEC(&States::start); + States::current = &States::start; expressions.eval(); throw Return(expressions.args()); } |