diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-24 18:19:52 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-24 18:19:52 +0100 |
commit | a532338ca642ed386270047aefc56ed11ef120d3 (patch) | |
tree | 9df9764806261912050fa0051a699f1aaf444a63 | |
parent | 14c1d149dd80ea9ab5fa73a10b2114c2801765c2 (diff) | |
download | sciteco-a532338ca642ed386270047aefc56ed11ef120d3.tar.gz |
fixed command line termination
* do it only in start state: so double escapes in strings do not cause a termination and an empty string may be specified
* clear arithmetic stacks on line termination
-rw-r--r-- | cmdline.cpp | 7 | ||||
-rw-r--r-- | expressions.h | 13 |
2 files changed, 18 insertions, 2 deletions
diff --git a/cmdline.cpp b/cmdline.cpp index deeeed3..fd37650 100644 --- a/cmdline.cpp +++ b/cmdline.cpp @@ -7,6 +7,7 @@ #include "sciteco.h" #include "interface.h" +#include "expressions.h" #include "parser.h" #include "qbuffers.h" #include "goto.h" @@ -128,7 +129,8 @@ process_edit_cmd(gchar key) break; case '\x1B': - if (cmdline && cmdline[cmdline_len - 1] == '\x1B') { + if (States::current == &States::start && + cmdline && cmdline[cmdline_len - 1] == '\x1B') { if (Goto::skip_label) { interface.msg(Interface::MSG_ERROR, "Label \"%s\" not found", @@ -141,9 +143,10 @@ process_edit_cmd(gchar key) exit(EXIT_SUCCESS); } - interface.ssm(SCI_EMPTYUNDOBUFFER); undo.clear(); + interface.ssm(SCI_EMPTYUNDOBUFFER); Goto::table->clear(); + expressions.clear(); *cmdline = '\0'; macro_pc = 0; diff --git a/expressions.h b/expressions.h index 5d2aa0c..a441e90 100644 --- a/expressions.h +++ b/expressions.h @@ -100,6 +100,12 @@ public: { return top[-index]; } + + inline void + clear(void) + { + top = stack; + } }; /* @@ -172,6 +178,13 @@ public: int find_op(Operator op); + inline void + clear(void) + { + numbers.clear(); + operators.clear(); + } + private: void calc(void); |