feat: add exit slash command alias for quit (#6002)
## Summary - add the `/exit` slash command alongside `/quit` and reuse shared exit handling - refactor the chat widget to funnel quit, exit, logout, and shutdown flows through a common `request_exit` helper - add focused unit tests that confirm both `/quit` and `/exit` send an `ExitRequest` ## Testing - `just fmt` - `just fix -p codex-tui` - `cargo test -p codex-tui` ------ https://chatgpt.com/codex/tasks/task_i_6903d5a8f47c8321bf180f031f2fa330
This commit is contained in:
@@ -657,7 +657,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
fn on_shutdown_complete(&mut self) {
|
||||
self.app_event_tx.send(AppEvent::ExitRequest);
|
||||
self.request_exit();
|
||||
}
|
||||
|
||||
fn on_turn_diff(&mut self, unified_diff: String) {
|
||||
@@ -1229,8 +1229,8 @@ impl ChatWidget {
|
||||
SlashCommand::Approvals => {
|
||||
self.open_approvals_popup();
|
||||
}
|
||||
SlashCommand::Quit => {
|
||||
self.app_event_tx.send(AppEvent::ExitRequest);
|
||||
SlashCommand::Quit | SlashCommand::Exit => {
|
||||
self.request_exit();
|
||||
}
|
||||
SlashCommand::Logout => {
|
||||
if let Err(e) = codex_core::auth::logout(
|
||||
@@ -1239,7 +1239,7 @@ impl ChatWidget {
|
||||
) {
|
||||
tracing::error!("failed to logout: {e}");
|
||||
}
|
||||
self.app_event_tx.send(AppEvent::ExitRequest);
|
||||
self.request_exit();
|
||||
}
|
||||
SlashCommand::Undo => {
|
||||
self.app_event_tx.send(AppEvent::CodexOp(Op::Undo));
|
||||
@@ -1593,6 +1593,10 @@ impl ChatWidget {
|
||||
}
|
||||
}
|
||||
|
||||
fn request_exit(&self) {
|
||||
self.app_event_tx.send(AppEvent::ExitRequest);
|
||||
}
|
||||
|
||||
fn request_redraw(&mut self) {
|
||||
self.frame_requester.schedule_frame();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user