mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00:00
Open tasks with Right from the agents overview (#44344)
## What changed Allow `Right` to open the selected task from the task list or an empty, focused composer. Preserve editor keybindings and guard against pending input, active popups, and offline state. Keep metadata editing unaffected and show the shortcut in navigation hints. ## Testing Add regression tests for opening the current or highlighted task, preserving cursor movement and renaming, and preventing navigation while offline. Update snapshots to cover the new hints. GitOrigin-RevId: 9fc01b62ad0829b964509ae6286a041fc4936b9d
This commit is contained in:
1 parent
1bff94edb6
commit
3ef3cecd20
13 files changed
+151
-9
No files matched your search
@@ -106,6 +106,96 @@ fn overview_draft(app: &App) -> (String, usize) {
|
||||
(composer.current_text_with_pending(), composer.cursor())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn overview_right_opens_current_or_highlighted_task() {
|
||||
let mut app = make_test_app().await;
|
||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
app.app_event_tx = AppEventSender::new(tx);
|
||||
let current = ThreadId::new();
|
||||
let other = ThreadId::new();
|
||||
app.primary_thread_id = Some(current);
|
||||
let threads = vec![
|
||||
overview_thread(
|
||||
current,
|
||||
/*parent_thread_id*/ None,
|
||||
"Current",
|
||||
ThreadStatus::Idle,
|
||||
),
|
||||
overview_thread(
|
||||
other,
|
||||
/*parent_thread_id*/ None,
|
||||
"Other",
|
||||
ThreadStatus::Idle,
|
||||
),
|
||||
];
|
||||
|
||||
let view = app.agents_overview_view(threads.clone(), /*selected_thread_id*/ None);
|
||||
app.chat_widget.show_bottom_pane_view(Box::new(view));
|
||||
let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 96);
|
||||
insta::assert_snapshot!(
|
||||
"overview_empty_prompt_right_hint",
|
||||
rendered.lines().last().unwrap()
|
||||
);
|
||||
app.chat_widget.handle_key_event(KeyCode::Right.into());
|
||||
assert!(
|
||||
matches!(rx.try_recv(), Ok(AppEvent::SelectAgentsOverviewThread { thread_id }) if thread_id == current)
|
||||
);
|
||||
assert!(app.chat_widget.no_modal_or_popup_active());
|
||||
|
||||
let mut view = app.agents_overview_view(threads, /*selected_thread_id*/ None);
|
||||
view.handle_key_event(KeyCode::Esc.into());
|
||||
view.handle_key_event(KeyCode::Down.into());
|
||||
app.chat_widget.show_bottom_pane_view(Box::new(view));
|
||||
let rendered = render_bottom_popup(&app.chat_widget, /*width*/ 96);
|
||||
insta::assert_snapshot!(
|
||||
"overview_right_open_hint",
|
||||
rendered.lines().find(|line| line.contains("open")).unwrap()
|
||||
);
|
||||
app.chat_widget.handle_key_event(KeyCode::Right.into());
|
||||
assert!(
|
||||
matches!(rx.try_recv(), Ok(AppEvent::SelectAgentsOverviewThread { thread_id }) if thread_id == other)
|
||||
);
|
||||
assert!(app.chat_widget.no_modal_or_popup_active());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn overview_right_preserves_editors_and_offline_state() {
|
||||
let mut app = make_test_app().await;
|
||||
app.config.disable_paste_burst = true;
|
||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
app.app_event_tx = AppEventSender::new(tx);
|
||||
let thread_id = ThreadId::new();
|
||||
let mut view = app.agents_overview_view(
|
||||
vec![overview_thread(
|
||||
thread_id,
|
||||
/*parent_thread_id*/ None,
|
||||
"Task",
|
||||
ThreadStatus::Idle,
|
||||
)],
|
||||
Some(thread_id),
|
||||
);
|
||||
view.handle_paste("ab".into());
|
||||
view.handle_key_event(KeyCode::Home.into());
|
||||
view.handle_key_event(KeyCode::Right.into());
|
||||
assert_eq!(overview_draft(&app), ("ab".into(), 1));
|
||||
view.handle_key_event(KeyCode::Esc.into());
|
||||
view.handle_key_event(KeyEvent::new(KeyCode::Char('r'), KeyModifiers::CONTROL));
|
||||
view.handle_key_event(KeyCode::Right.into());
|
||||
assert!(app.agents_overview.view_state.lock().unwrap().renaming);
|
||||
view.handle_key_event(KeyCode::Esc.into());
|
||||
app.agents_overview
|
||||
.view_state
|
||||
.lock()
|
||||
.unwrap()
|
||||
.connection_notice = Some("Offline");
|
||||
view.handle_key_event(KeyCode::Right.into());
|
||||
view.handle_key_event(KeyEvent::new(KeyCode::Char('n'), KeyModifiers::CONTROL));
|
||||
view.on_ctrl_c();
|
||||
view.handle_key_event(KeyCode::Right.into());
|
||||
assert!(!view.is_complete());
|
||||
assert!(rx.try_recv().is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn overview_composer_preserves_editing_and_routes_focus() {
|
||||
let mut app = make_test_app().await;
|
||||
|
||||
Reference in new issue
Block a user