mirror of
https://github.com/openai/codex.git
synced 2026-11-30 00:10:49 +00:00
Move reset picker cancel action to the end
This commit is contained in:
+3
-3
@@ -5,9 +5,9 @@ expression: "render_bottom_popup(&chat, 44)"
|
||||
Usage limit resets
|
||||
2 usage limit resets available.
|
||||
|
||||
› 1. Cancel
|
||||
2. Full reset Expires 09:39 on 18 Jun
|
||||
› 1. Full reset Expires 09:39 on 18 Jun
|
||||
2026.
|
||||
3. Full reset Does not expire.
|
||||
2. Full reset Does not expire.
|
||||
3. Cancel
|
||||
|
||||
Press enter to confirm or esc to go back
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ expression: "states.join(\"\\n---\\n\")"
|
||||
Usage limit resets
|
||||
2 usage limit resets available.
|
||||
|
||||
› 1. Cancel
|
||||
2. Full reset (Weekly + 5 hr) Expires 09:39 on 18 Jun 2026.
|
||||
3. Full reset (Weekly + 5 hr) Expires 08:59 on 27 Jun 2026.
|
||||
› 1. Full reset (Weekly + 5 hr) Expires 09:39 on 18 Jun 2026.
|
||||
2. Full reset (Weekly + 5 hr) Expires 08:59 on 27 Jun 2026.
|
||||
3. Cancel
|
||||
|
||||
Press enter to confirm or esc to go back
|
||||
---
|
||||
|
||||
@@ -441,7 +441,6 @@ async fn rate_limit_reset_confirmation_uses_backend_copy_snapshot() {
|
||||
vec![credit],
|
||||
)),
|
||||
));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
|
||||
let Ok(AppEvent::OpenRateLimitResetConfirmation {
|
||||
@@ -495,7 +494,6 @@ async fn rate_limit_reset_confirmation_no_and_escape_return_to_picker() {
|
||||
Vec::new(),
|
||||
Ok(reset_credits(/*available_count*/ 1)),
|
||||
));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
let picker = render_bottom_popup(&chat, /*width*/ 80);
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
@@ -533,7 +531,6 @@ async fn rejected_reset_confirmation_rearms_its_picker_row() {
|
||||
)),
|
||||
));
|
||||
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
@@ -594,7 +591,7 @@ async fn rate_limit_reset_picker_starts_with_soonest_expiries_and_keeps_all_rows
|
||||
);
|
||||
assert!(!rendered.contains("Full reset ("), "{rendered}");
|
||||
|
||||
for _ in 0..9 {
|
||||
for _ in 0..8 {
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
}
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
@@ -629,7 +626,6 @@ async fn rate_limit_reset_confirmation_can_use_reset() {
|
||||
)),
|
||||
));
|
||||
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
chat.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
show_rate_limit_reset_confirmation_from_event(&mut chat, &mut rx);
|
||||
assert!(rx.try_recv().is_err());
|
||||
|
||||
@@ -169,42 +169,41 @@ impl ChatWidget {
|
||||
picker_request_id: u64,
|
||||
reset_credits: &RateLimitResetCreditsSummary,
|
||||
) -> SelectionViewParams {
|
||||
let mut items = vec![SelectionItem {
|
||||
let mut items = reset_credit_options(reset_credits)
|
||||
.into_iter()
|
||||
.map(|option| {
|
||||
let confirmation_gate = Arc::new(AtomicBool::new(true));
|
||||
let credit_id = option.credit_id;
|
||||
let reset_title = option.name.clone();
|
||||
let reset_detail = option.detail;
|
||||
let reset_description = option.description;
|
||||
let picker_description = reset_detail
|
||||
.clone()
|
||||
.unwrap_or_else(|| reset_description.clone());
|
||||
SelectionItem {
|
||||
name: option.name,
|
||||
description: Some(picker_description),
|
||||
actions: vec![Box::new(move |tx| {
|
||||
if confirmation_gate.swap(false, Ordering::AcqRel) {
|
||||
tx.send(AppEvent::OpenRateLimitResetConfirmation {
|
||||
picker_request_id,
|
||||
confirmation_gate: confirmation_gate.clone(),
|
||||
credit_id: credit_id.clone(),
|
||||
reset_title: reset_title.clone(),
|
||||
reset_detail: reset_detail.clone(),
|
||||
reset_description: reset_description.clone(),
|
||||
});
|
||||
}
|
||||
})],
|
||||
..Default::default()
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
items.push(SelectionItem {
|
||||
name: "Cancel".to_string(),
|
||||
dismiss_on_select: true,
|
||||
..Default::default()
|
||||
}];
|
||||
items.extend(
|
||||
reset_credit_options(reset_credits)
|
||||
.into_iter()
|
||||
.map(|option| {
|
||||
let confirmation_gate = Arc::new(AtomicBool::new(true));
|
||||
let credit_id = option.credit_id;
|
||||
let reset_title = option.name.clone();
|
||||
let reset_detail = option.detail;
|
||||
let reset_description = option.description;
|
||||
let picker_description = reset_detail
|
||||
.clone()
|
||||
.unwrap_or_else(|| reset_description.clone());
|
||||
SelectionItem {
|
||||
name: option.name,
|
||||
description: Some(picker_description),
|
||||
actions: vec![Box::new(move |tx| {
|
||||
if confirmation_gate.swap(false, Ordering::AcqRel) {
|
||||
tx.send(AppEvent::OpenRateLimitResetConfirmation {
|
||||
picker_request_id,
|
||||
confirmation_gate: confirmation_gate.clone(),
|
||||
credit_id: credit_id.clone(),
|
||||
reset_title: reset_title.clone(),
|
||||
reset_detail: reset_detail.clone(),
|
||||
reset_description: reset_description.clone(),
|
||||
});
|
||||
}
|
||||
})],
|
||||
..Default::default()
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
SelectionViewParams {
|
||||
view_id: Some(RATE_LIMIT_RESET_VIEW_ID),
|
||||
title: Some("Usage limit resets".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user