From 18152bdded3cf194a574647a125eb95ec05156e5 Mon Sep 17 00:00:00 2001 From: Soispha Date: Wed, 18 Oct 2023 23:09:09 +0200 Subject: [PATCH] fix(key_input): Also input pending keys, when leaving KeyInputPending --- .../event_types/event/handlers/input.rs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/events/event_types/event/handlers/input.rs b/src/app/events/event_types/event/handlers/input.rs index ce9bbad..04df794 100644 --- a/src/app/events/event_types/event/handlers/input.rs +++ b/src/app/events/event_types/event/handlers/input.rs @@ -12,7 +12,25 @@ use crate::app::{ pub async fn handle(app: &mut App<'_>, input_event: &CrosstermEvent) -> Result { async fn default(converted_key: Key, app: &mut App<'_>, old_state: &State) -> Result<()> { - info!("No keymaps exist for key ('{}'), passing it along..", converted_key); + info!( + "No keymaps exist for key ('{}'), passing it along..", + converted_key + ); + if let State::KeyInputPending { + old_state: _, + pending_keys, + } = app.status.state().clone() + { + for key in pending_keys { + app.tx + .send(Event::CommandEvent( + Command::Trinitrix(Api(Raw(SendInputUnprocessed(key.to_string_repr())))), + None, + )) + .await?; + } + app.status.set_state(old_state.to_owned()); + } // Just let the input event slip through if no keymap matches app.tx .send(Event::CommandEvent( @@ -22,7 +40,6 @@ pub async fn handle(app: &mut App<'_>, input_event: &CrosstermEvent) -> Result, input_event: &CrosstermEvent) -> Result