From 49903523a7f28c18d324bf605876b9d18a97047b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 16 Sep 2013 18:48:41 +0100 Subject: [PATCH] Resurect Client::handle_available_input() --- src/client.cc | 7 +++++++ src/client.hh | 3 +++ src/client_manager.cc | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/client.cc b/src/client.cc index 979d132e..aabe52eb 100644 --- a/src/client.cc +++ b/src/client.cc @@ -978,6 +978,13 @@ bool is_valid(Key key) return key != Key::Invalid and key.key <= 0x10FFFF; } +void Client::handle_available_input() +{ + while (m_ui->is_key_available()) + handle_key(m_ui->get_key()); + m_context.window().forget_timestamp(); +} + void Client::handle_key(Key key) { if (is_valid(key)) diff --git a/src/client.hh b/src/client.hh index 7c300929..ef1a178d 100644 --- a/src/client.hh +++ b/src/client.hh @@ -64,6 +64,9 @@ public: // if callback does not change the mode itself void on_next_key(KeyCallback callback); + + // handle all the keys currently available in the user interface + void handle_available_input(); // process the given key void handle_key(Key key); diff --git a/src/client_manager.cc b/src/client_manager.cc index 0f0c65e7..c50d313e 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -50,9 +50,7 @@ Client* ClientManager::create_client(std::unique_ptr&& ui, client->ui().set_input_callback([client, this]() { try { - while (client->ui().is_key_available()) - client->handle_key(client->ui().get_key()); - client->context().window().forget_timestamp(); + client->handle_available_input(); } catch (Kakoune::runtime_error& error) {