Resurect Client::handle_available_input()

This commit is contained in:
Maxime Coste 2013-09-16 18:48:41 +01:00
parent 27a1e70b01
commit 49903523a7
3 changed files with 11 additions and 3 deletions

View File

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

View File

@ -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);

View File

@ -50,9 +50,7 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& 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)
{