From 916a0cb52e8637d0e6ec456363ef6412142945da Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 11 Sep 2013 18:54:30 +0100 Subject: Allow :exec mode changes to remains when keys are finished Pass keys one by one to the input handler so that BatchUI is not needed We can now use :exec to pre-fill the command line without validating the command. --- src/input_handler.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/input_handler.cc') diff --git a/src/input_handler.cc b/src/input_handler.cc index 72b68aa0..cd048482 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -978,24 +978,19 @@ bool is_valid(Key key) return key != Key::Invalid and key.key <= 0x10FFFF; } -void InputHandler::handle_available_inputs() +void InputHandler::handle_key(Key key) { - m_mode_trash.clear(); - while (m_context.ui().is_key_available()) + if (is_valid(key)) { - Key key = m_context.ui().get_key(); - if (is_valid(key)) - { - const bool was_recording = is_recording(); + const bool was_recording = is_recording(); - m_mode->on_key(key); + m_mode->on_key(key); - // do not record the key that made us enter or leave recording mode. - if (was_recording and is_recording()) - m_recorded_keys += key_to_str(key); - } - m_mode_trash.clear(); + // do not record the key that made us enter or leave recording mode. + if (was_recording and is_recording()) + m_recorded_keys += key_to_str(key); } + m_mode_trash.clear(); } void InputHandler::start_recording(char reg) -- cgit v1.2.3