diff options
-rw-r--r-- | src/cmdline.cpp | 4 | ||||
-rw-r--r-- | src/parser.h | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/cmdline.cpp b/src/cmdline.cpp index 271e2be..8c5bc42 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -391,7 +391,7 @@ Cmdline::process_edit_cmd(gchar key) /* reinsert command */ do insert(); - while (States::current != &States::start && rubout_len); + while (!States::is_start() && rubout_len); } else { /* rubout command */ rubout_command(); @@ -565,7 +565,7 @@ Cmdline::fnmacro(const gchar *name) goto default_action; mask = reg->get_integer(); - if (States::current == &States::start) { + if (States::is_start()) { if (mask & FNMACRO_MASK_START) return; } else if (States::is_string()) { diff --git a/src/parser.h b/src/parser.h index b502f46..b18e13c 100644 --- a/src/parser.h +++ b/src/parser.h @@ -333,6 +333,17 @@ namespace States { extern State *current; static inline bool + is_start() + { + /* + * The "escape" state exists only as a hack, + * to support $$. Otherwise it should behave + * like the start state. + */ + return current == &start || current == &escape; + } + + static inline bool is_string() { return dynamic_cast<StateExpectString *>(current); |