fix(tui/keys): route Ctrl+Z to composer undo in Chat; keep suspend on non-chat screens

Previously Ctrl+Z always triggered Unix job control (suspend), preventing
in-app undo. Now, when in Chat, we forward Ctrl+Z to the widget so the
TextArea can perform an undo; Onboarding still suspends on Unix.
This commit is contained in:
James Peter
2025-09-08 11:25:02 +10:00
parent a589aeeef2
commit 0cbeb651fc
+13 -4
View File
@@ -564,11 +564,20 @@ impl App<'_> {
kind: KeyEventKind::Press,
..
} => {
#[cfg(unix)]
{
self.suspend(terminal)?;
// Prefer in-app undo in Chat (composer) over shell suspend.
match &mut self.app_state {
AppState::Chat { widget } => {
widget.handle_key_event(key_event);
self.app_event_tx.send(AppEvent::RequestRedraw);
}
AppState::Onboarding { .. } => {
#[cfg(unix)]
{
self.suspend(terminal)?;
}
// No-op on non-Unix platforms.
}
}
// No-op on non-Unix platforms.
}
KeyEvent {
code: KeyCode::Char('r') | KeyCode::Char('t'),