Clear non-empty prompts with ctrl + c (#3285)
This updates the ctrl + c behavior to clear the current prompt if there is text and you press ctrl + c. I also updated the ctrl + c hint text to show `^c to interrupt` instead of `^c to quit` if there is an active conversation. Two things I don't love: 1. You can currently interrupt a conversation with escape or ctrl + c (not related to this PR and maybe fine) 2. The bottom row hint text always says `^c to quit` but this PR doesn't really make that worse. https://github.com/user-attachments/assets/6eddadec-0d84-4fa7-abcb-d6f5a04e5748 Fixes https://github.com/openai/codex/issues/3126
This commit is contained in:
@@ -1288,15 +1288,17 @@ impl ChatWidget {
|
||||
|
||||
/// Handle Ctrl-C key press.
|
||||
fn on_ctrl_c(&mut self) {
|
||||
if self.bottom_pane.on_ctrl_c() == CancellationEvent::Ignored {
|
||||
if self.bottom_pane.is_task_running() {
|
||||
self.submit_op(Op::Interrupt);
|
||||
} else if self.bottom_pane.ctrl_c_quit_hint_visible() {
|
||||
self.submit_op(Op::Shutdown);
|
||||
} else {
|
||||
self.bottom_pane.show_ctrl_c_quit_hint();
|
||||
}
|
||||
if self.bottom_pane.on_ctrl_c() == CancellationEvent::Handled {
|
||||
return;
|
||||
}
|
||||
|
||||
if self.bottom_pane.is_task_running() {
|
||||
self.bottom_pane.show_ctrl_c_quit_hint();
|
||||
self.submit_op(Op::Interrupt);
|
||||
return;
|
||||
}
|
||||
|
||||
self.submit_op(Op::Shutdown);
|
||||
}
|
||||
|
||||
pub(crate) fn composer_is_empty(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user