Resurect Client::handle_available_input()
This commit is contained in:
parent
27a1e70b01
commit
49903523a7
|
@ -978,6 +978,13 @@ bool is_valid(Key key)
|
||||||
return key != Key::Invalid and key.key <= 0x10FFFF;
|
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)
|
void Client::handle_key(Key key)
|
||||||
{
|
{
|
||||||
if (is_valid(key))
|
if (is_valid(key))
|
||||||
|
|
|
@ -64,6 +64,9 @@ public:
|
||||||
// if callback does not change the mode itself
|
// if callback does not change the mode itself
|
||||||
void on_next_key(KeyCallback callback);
|
void on_next_key(KeyCallback callback);
|
||||||
|
|
||||||
|
|
||||||
|
// handle all the keys currently available in the user interface
|
||||||
|
void handle_available_input();
|
||||||
// process the given key
|
// process the given key
|
||||||
void handle_key(Key key);
|
void handle_key(Key key);
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,7 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
|
||||||
client->ui().set_input_callback([client, this]() {
|
client->ui().set_input_callback([client, this]() {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (client->ui().is_key_available())
|
client->handle_available_input();
|
||||||
client->handle_key(client->ui().get_key());
|
|
||||||
client->context().window().forget_timestamp();
|
|
||||||
}
|
}
|
||||||
catch (Kakoune::runtime_error& error)
|
catch (Kakoune::runtime_error& error)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user