mirror of
https://github.com/openai/codex.git
synced 2026-09-15 12:08:01 +00:00
fix(tui): accept ctrl-up for queued message edit
This commit is contained in:
@@ -3100,10 +3100,12 @@ impl ChatWidget {
|
||||
}
|
||||
KeyEvent {
|
||||
code: KeyCode::Up,
|
||||
modifiers: KeyModifiers::ALT,
|
||||
modifiers,
|
||||
kind: KeyEventKind::Press,
|
||||
..
|
||||
} if !self.queued_user_messages.is_empty() => {
|
||||
} if modifiers.intersects(KeyModifiers::ALT | KeyModifiers::CONTROL)
|
||||
&& !self.queued_user_messages.is_empty() =>
|
||||
{
|
||||
// Prefer the most recently queued item.
|
||||
if let Some(user_message) = self.queued_user_messages.pop_back() {
|
||||
self.restore_user_message_to_composer(user_message);
|
||||
|
||||
@@ -2807,6 +2807,30 @@ async fn alt_up_edits_most_recent_queued_message() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn control_up_edits_most_recent_queued_message() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(None).await;
|
||||
|
||||
chat.bottom_pane.set_task_running(true);
|
||||
chat.queued_user_messages
|
||||
.push_back(UserMessage::from("first queued".to_string()));
|
||||
chat.queued_user_messages
|
||||
.push_back(UserMessage::from("second queued".to_string()));
|
||||
chat.refresh_queued_user_messages();
|
||||
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Up, KeyModifiers::CONTROL));
|
||||
|
||||
assert_eq!(
|
||||
chat.bottom_pane.composer_text(),
|
||||
"second queued".to_string()
|
||||
);
|
||||
assert_eq!(chat.queued_user_messages.len(), 1);
|
||||
assert_eq!(
|
||||
chat.queued_user_messages.front().unwrap().text,
|
||||
"first queued"
|
||||
);
|
||||
}
|
||||
|
||||
/// Pressing Up to recall the most recent history entry and immediately queuing
|
||||
/// it while a task is running should always enqueue the same text, even when it
|
||||
/// is queued repeatedly.
|
||||
|
||||
Reference in New Issue
Block a user