summaryrefslogtreecommitdiff
path: root/src/input_handler.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-06-02 20:56:57 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-06-02 20:56:57 +0100
commit964b0e9a6ee0672da725450c856315244e6f68c5 (patch)
treeaa2e2452051f785943e83d739b9193c0f31239d0 /src/input_handler.hh
parent1ff0fbb4e2c761f263133be8824b333c3b4cfbdb (diff)
InputHandler now uses a stack for active modes
instead of having a single mode enabled, modes can be pushed/poped, with the top of the stack being the active mode.
Diffstat (limited to 'src/input_handler.hh')
-rw-r--r--src/input_handler.hh7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/input_handler.hh b/src/input_handler.hh
index 8086323c..999f444b 100644
--- a/src/input_handler.hh
+++ b/src/input_handler.hh
@@ -87,10 +87,13 @@ private:
Context m_context;
friend class InputMode;
- std::unique_ptr<InputMode> m_mode;
+ Vector<std::unique_ptr<InputMode>> m_mode_stack;
Vector<std::unique_ptr<InputMode>> m_mode_trash;
- void change_input_mode(InputMode* new_mode);
+ InputMode& current_mode() const { return *m_mode_stack.back(); }
+
+ void push_mode(InputMode* new_mode);
+ void pop_mode(InputMode* current_mode);
using Insertion = std::pair<InsertMode, Vector<Key>>;
Insertion m_last_insert = {InsertMode::Insert, {}};