fix(key_input): Also input pending keys, when leaving KeyInputPending
This commit is contained in:
parent
0ed99b6244
commit
18152bdded
|
@ -12,7 +12,25 @@ use crate::app::{
|
|||
|
||||
pub async fn handle(app: &mut App<'_>, input_event: &CrosstermEvent) -> Result<EventStatus> {
|
||||
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<E
|
|||
None,
|
||||
))
|
||||
.await?;
|
||||
app.status.set_state(old_state.to_owned());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -66,7 +83,8 @@ pub async fn handle(app: &mut App<'_>, input_event: &CrosstermEvent) -> Result<E
|
|||
if possible_key_maps.len() == 1 {
|
||||
let possible_key_map = possible_key_maps.get(0).expect("The len is 1");
|
||||
|
||||
if possible_key_map.is_child() && possible_key_map.is_terminal() && should_call {
|
||||
if possible_key_map.is_child() && possible_key_map.is_terminal() && should_call
|
||||
{
|
||||
let function = possible_key_map
|
||||
.value()
|
||||
.expect("This node is terminal and a child, it should have a value");
|
||||
|
|
Reference in New Issue