diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-02-15 16:43:39 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-02-15 16:43:39 +0800 |
commit | ee7369022611745ec9c55beddf1b907f13ed3559 (patch) | |
tree | c6cbceafd18bd35e7f2646ac90db996df58cd370 | |
parent | 6d7b3cd062214f2cc66886d49d1a60406204abf3 (diff) |
Enforce drawing once after traversal is done
Otherwise some 'scanning' message is likely to remain if there is no
additional user input.
-rw-r--r-- | src/interactive/app/eventloop.rs | 11 | ||||
-rw-r--r-- | src/main.rs | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs index d18ff44..b6c0abf 100644 --- a/src/interactive/app/eventloop.rs +++ b/src/interactive/app/eventloop.rs @@ -279,7 +279,7 @@ impl TerminalApp { }; Ok(should_exit) })?; - let traversal = match traversal { + let mut traversal = match traversal { Some(t) => t, None => return Ok(None), }; @@ -306,6 +306,15 @@ impl TerminalApp { } else { s.entries.get(0).map(|b| b.index) }; + // Force event processing with a key that doesn't do anything. + s.process_events( + &mut window, + &mut traversal, + &mut display, + terminal, + std::iter::once(Key::Alt('\r')), + ) + .ok(); s }, display, diff --git a/src/main.rs b/src/main.rs index ce2e728..a89eb46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,7 @@ fn main() -> Result<()> { )? .map(|(keys_rx, mut app)| { let res = app.process_events(&mut terminal, keys_rx.into_iter()); - // Leak app memory to avoid having to wait for the hashmap to deallocate, which causes a noticable delay shortly before the the + // Leak app memory to avoid having to wait for the hashmap to deallocate, which causes a noticeable delay shortly before the the // program exits anyway. std::mem::forget(app); res |