From 0a0d0b7cd9ce2942d5194762478a4e24cd05eca4 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 8 Mar 2017 12:51:06 +0100 Subject: fixup to 89224899: fixed function key macros after $ and the rubout-command editing key * StateEscape should return the same fnmacro mask as StateStart * When rubbing out a command, we should stop at StateEscape as well. Therefore we reintroduced States::is_start(). RTTI is still not used. --- src/cmdline.cpp | 4 ++-- src/parser.h | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cmdline.cpp b/src/cmdline.cpp index 55d63d7..7a1e6cf 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -586,12 +586,12 @@ State::process_edit_cmd(gchar key) /* reinsert command */ do cmdline.insert(); - while (States::current != &States::start && cmdline.rubout_len); + while (!States::is_start() && cmdline.rubout_len); } else { /* rubout command */ do cmdline.rubout(); - while (States::current != &States::start); + while (!States::is_start()); } return; diff --git a/src/parser.h b/src/parser.h index 700d25f..56e58c4 100644 --- a/src/parser.h +++ b/src/parser.h @@ -300,6 +300,16 @@ private: State *custom(gchar chr); void end_of_macro(void); + + /* + * The state should behave like StateStart + * when it comes to function key macro masking. + */ + fnmacroMask + get_fnmacro_mask(void) const + { + return FNMACRO_MASK_START; + } }; class StateFCommand : public State { @@ -405,6 +415,15 @@ namespace States { extern StateInsertIndent insert_indent; extern State *current; + + static inline bool + is_start(void) + { + /* + * StateEscape should behave very much like StateStart. + */ + return current == &start || current == &escape; + } } extern enum Mode { -- cgit v1.2.3