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) {