mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
fix(tui): remove duplicate context statusline item (#18054)
Addresses #18045 Problem: `/statusline` exposed both `context-remaining` and `context-remaining-percent` after conflicting PRs attempted to address the same context-status issue, including #17637, allowing duplicate footer segments. Solution: Remove the duplicate `context-remaining-percent` status-line item and update status-line tests and snapshots to use only canonical `context-remaining`.
This commit is contained in:
committed by
GitHub
Unverified
parent
b4be3617f9
commit
8475d51655
@@ -450,7 +450,7 @@ impl ChatWidget {
|
||||
Some(format!("{} used", format_tokens_compact(total)))
|
||||
}
|
||||
}
|
||||
StatusLineItem::ContextRemaining | StatusLineItem::ContextRemainingPercent => self
|
||||
StatusLineItem::ContextRemaining => self
|
||||
.status_line_context_remaining_percent()
|
||||
.map(|remaining| format!("Context {remaining}% left")),
|
||||
StatusLineItem::ContextUsed => self
|
||||
|
||||
@@ -914,24 +914,6 @@ async fn status_line_legacy_context_usage_renders_context_used_percent() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_line_context_remaining_percent_renders_labeled_percent() {
|
||||
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
chat.thread_id = Some(ThreadId::new());
|
||||
chat.config.tui_status_line = Some(vec!["context-remaining-percent".to_string()]);
|
||||
|
||||
chat.refresh_status_line();
|
||||
|
||||
assert_eq!(
|
||||
status_line_text(&chat),
|
||||
Some("Context 100% left".to_string())
|
||||
);
|
||||
assert!(
|
||||
drain_insert_history(&mut rx).is_empty(),
|
||||
"context-remaining-percent should remain a valid status line item"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_line_branch_state_resets_when_git_branch_disabled() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
|
||||
@@ -1200,7 +1182,7 @@ async fn status_line_model_with_reasoning_fast_footer_snapshot() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn status_line_model_with_reasoning_context_remaining_percent_footer_snapshot() {
|
||||
async fn status_line_model_with_reasoning_context_remaining_footer_snapshot() {
|
||||
use ratatui::Terminal;
|
||||
use ratatui::backend::TestBackend;
|
||||
|
||||
@@ -1211,7 +1193,7 @@ async fn status_line_model_with_reasoning_context_remaining_percent_footer_snaps
|
||||
chat.config.cwd = test_project_path().abs();
|
||||
chat.config.tui_status_line = Some(vec![
|
||||
"model-with-reasoning".to_string(),
|
||||
"context-remaining-percent".to_string(),
|
||||
"context-remaining".to_string(),
|
||||
"current-dir".to_string(),
|
||||
]);
|
||||
chat.set_reasoning_effort(Some(ReasoningEffortConfig::XHigh));
|
||||
@@ -1228,7 +1210,7 @@ async fn status_line_model_with_reasoning_context_remaining_percent_footer_snaps
|
||||
.draw(|f| chat.render(f.area(), f.buffer_mut()))
|
||||
.expect("draw model-with-reasoning footer");
|
||||
assert_chatwidget_snapshot!(
|
||||
"status_line_model_with_reasoning_context_remaining_percent_footer",
|
||||
"status_line_model_with_reasoning_context_remaining_footer",
|
||||
normalized_backend_snapshot(terminal.backend())
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user