From 541c6c3168b2fa1fc8f6a59fd668ea8fc337f1fb Mon Sep 17 00:00:00 2001 From: Kevin Hoerr Date: Mon, 2 Mar 2026 23:07:06 +0000 Subject: main.rs: Call App to set and clear error --- src/main/rust/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/rust') diff --git a/src/main/rust/main.rs b/src/main/rust/main.rs index 043702c..dad7f7c 100644 --- a/src/main/rust/main.rs +++ b/src/main/rust/main.rs @@ -55,7 +55,11 @@ fn run_app(term: &mut Terminal, app: &mut App) -> Result<()> { // it's important to check that the event is a key press event as // crossterm also emits key release and repeat events on Windows. Event::Key(key_event) if key_event.kind == KeyEventKind::Press => { - handle_key_event(app, key_event)?; + // if error occurred during input processing, set error in the app state + match handle_key_event(app, key_event) { + Err(e) => app.set_error(e)?, + _ => {} + } } _ => {} }; @@ -71,6 +75,8 @@ fn handle_key_event(app: &mut App, key_event: KeyEvent) -> Result<()> { KeyCode::Right => app.increment_counter()?, _ => {} }; + // any new key event, we should clear the existing error + app.clear_error()?; Ok(()) } -- cgit v1.3