Render /status without borders and wrap long values (#48754)

## Why

The status card truncates values in narrow terminals, hiding parts of paths, session IDs, and other details.

## What changed

- Remove the status border and wrap values with continuation lines aligned beneath the value column, falling back to less indentation at very narrow widths.
- Preserve full directory paths and session IDs in displayed and copied status output.
- Allow history updates with no previous rows to append new details while preserving existing history rows.

## Testing

Add regression coverage for long Unicode paths and session IDs across terminal widths, copied text, usage links, and appending late thread-usage details. Update status snapshots for the borderless layout and wrapped values.

GitOrigin-RevId: e059fed5b45e15b76250b684f1760797442eabce
This commit is contained in:
Felipe Coury
2026-09-27 17:31:45 +00:00
committed by copyberry
parent 18344a972d
commit 819cdb726d
32 changed files with 566 additions and 545 deletions
@@ -4,17 +4,17 @@ expression: "whole_status.replace(&directory,\n\"[[workspace]]\").replace(crate:
---
>_ OpenAI Codex (vVERSION)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: GPT-5.5 (reasoning medium, summaries auto)
Model provider: openai
Directory: [[workspace]]
Permissions: Read Only (Ask for approval)
Agents.md: <none>
Thread name: Clipboard example
Collaboration mode: Default
Session: 00000000-0000-0000-0000-000000000123
Model: GPT-5.5 (reasoning medium, summaries auto)
Model provider: openai
Directory: [[workspace]]
Permissions: Read Only (Ask for approval)
Agents.md: <none>
Thread name: Clipboard example
Collaboration mode: Default
Session: 00000000-0000-0000-0000-000000000123
Token usage: 0 total (0 input + 0 output)
Limits: data not available yet
Token usage: 0 total (0 input + 0 output)
Limits: data not available yet
@@ -2,9 +2,8 @@
source: tui/src/chatwidget/tests/status_command_tests.rs
expression: thread_usage
---
│ Thread usage: 50 credits · ~$1.82 │
│ Models: GPT-5.4 80%, GPT-5 Mini 20% │
│ Reasoning: Medium 20%, High 80% │
│ Speed: Fast mode 80%, Standard 20% │
│ Billed tokens: 120 input (25 cached) + 50 output │
╰──────────────────────────────────────────────────────────────────────╯
Thread usage: 50 credits · ~$1.82
Models: GPT-5.4 80%, GPT-5 Mini 20%
Reasoning: Medium 20%, High 80%
Speed: Fast mode 80%, Standard 20%
Billed tokens: 120 input (25 cached) + 50 output
@@ -2,9 +2,8 @@
source: tui/src/chatwidget/tests/status_command_tests.rs
expression: thread_usage
---
│ Thread usage: 50 credits │
│ Models: GPT-5.4 100% │
│ Reasoning: High 100% │
│ Speed: Fast mode 100% │
│ Billed tokens: 100 input (20 cached) + 40 output │
╰──────────────────────────────────────────────────────────────────────╯
Thread usage: 50 credits
Models: GPT-5.4 100%
Reasoning: High 100%
Speed: Fast mode 100%
Billed tokens: 100 input (20 cached) + 40 output
+69 -46
View File
@@ -2,7 +2,6 @@ use crate::history_cell::CompositeHistoryCell;
use crate::history_cell::HistoryCell;
use crate::history_cell::PlainHistoryCell;
use crate::history_cell::plain_lines;
use crate::history_cell::with_border_with_inner_width;
use crate::legacy_core::config::Config;
use crate::line_truncation::line_width;
use crate::style::accent_color;
@@ -33,7 +32,6 @@ use std::path::PathBuf;
use super::account::StatusAccountDisplay;
use super::format::FieldFormatter;
use super::format::push_label;
use super::format::truncate_line_to_width;
use super::helpers::compose_account_display;
use super::helpers::compose_model_display;
use super::helpers::format_directory_display;
@@ -49,7 +47,6 @@ use super::rate_limits::render_status_limit_progress_bar;
use super::remote_connection::RemoteConnectionStatus;
use super::thread_usage::StatusThreadUsage;
use crate::wrapping::RtOptions;
use crate::wrapping::adaptive_wrap_lines;
use crate::wrapping::word_wrap_lines;
use std::sync::Arc;
use std::sync::RwLock;
@@ -733,15 +730,11 @@ fn status_approval_label(
impl StatusHistoryCell {
fn content_lines(&self, width: u16) -> Vec<Line<'static>> {
let mut lines: Vec<Line<'static>> = Vec::new();
let mut title = vec![FieldFormatter::INDENT.into()];
title.extend(crate::history_cell::codex_title(CODEX_CLI_VERSION));
lines.push(Line::from(title));
let available_inner_width = usize::from(width.saturating_sub(4));
if available_inner_width == 0 {
let available_width = usize::from(width);
if available_width == 0 {
return Vec::new();
}
let mut lines = Vec::new();
let account_value = self.account.as_ref().map(|account| match account {
StatusAccountDisplay::ChatGpt { email, plan } => match (email, plan) {
@@ -799,27 +792,8 @@ impl StatusHistoryCell {
self.thread_usage.push_labels(&mut labels, &mut seen);
let formatter = FieldFormatter::from_labels(labels.iter().map(String::as_str));
let value_width = formatter.value_width(available_inner_width);
let value_width = formatter.value_width(available_width);
let note_first_line = Line::from(vec![
Span::from("Visit ").fg(accent_color()),
CHATGPT_USAGE_URL.fg(accent_color()).underlined(),
Span::from(" for up-to-date").fg(accent_color()),
]);
let note_second_line = Line::from(vec![
Span::from("information on rate limits and credits").fg(accent_color()),
]);
let note_lines = adaptive_wrap_lines(
[note_first_line, note_second_line],
RtOptions::new(available_inner_width),
);
lines.push(Line::from(Vec::<Span<'static>>::new()));
// The ChatGPT usage page only applies to providers backed by OpenAI auth;
// providers like Bedrock manage limits and billing elsewhere.
if self.show_chatgpt_usage_link {
lines.extend(note_lines);
lines.push(Line::from(Vec::<Span<'static>>::new()));
}
if let Some(remote_connection) = self.remote_connection.as_ref() {
let value = if remote_connection.is_local_daemon {
Line::from("Local background server")
@@ -847,7 +821,7 @@ impl StatusHistoryCell {
model_spans.push(Span::from(")").dim());
}
let directory_value = format_directory_display(&self.directory, Some(value_width));
let directory_value = format_directory_display(&self.directory, /*max_width*/ None);
lines.push(formatter.line("Model", model_spans));
if let Some(model_provider) = self.model_provider.as_ref() {
@@ -886,32 +860,81 @@ impl StatusHistoryCell {
lines.push(formatter.line("Context window", spans));
}
lines.extend(self.rate_limit_lines(&rate_limit_state, available_inner_width, &formatter));
lines.extend(self.rate_limit_lines(&rate_limit_state, available_width, &formatter));
let thread_usage_lines = self.thread_usage.lines(&formatter, value_width);
if !thread_usage_lines.is_empty() {
lines.push(Line::from(Vec::<Span<'static>>::new()));
lines.extend(thread_usage_lines);
}
lines
// Leave room for the two-column title mark even in a tiny terminal.
let indent = if available_width >= FieldFormatter::INDENT.len() + 2 {
FieldFormatter::INDENT
} else {
""
};
let mut title = vec![indent.into()];
title.extend(crate::history_cell::codex_title(CODEX_CLI_VERSION));
let mut rendered = word_wrap_lines(
[Line::from(title)],
RtOptions::new(available_width).subsequent_indent(indent.into()),
);
rendered.push(Line::default());
// Providers such as Bedrock manage limits and billing elsewhere.
if self.show_chatgpt_usage_link {
rendered.extend(word_wrap_lines(
[
Line::from(vec![
"Visit ".fg(accent_color()),
CHATGPT_USAGE_URL.fg(accent_color()).underlined(),
" for up-to-date".fg(accent_color()),
]),
"information on rate limits and credits"
.fg(accent_color())
.into(),
],
RtOptions::new(available_width)
.initial_indent(indent.into())
.subsequent_indent(indent.into())
.word_separator(textwrap::WordSeparator::AsciiSpace)
.word_splitter(textwrap::WordSplitter::NoHyphenation),
));
rendered.push(Line::default());
}
// Keep every value, including long paths and IDs, aligned beneath its first line.
// At widths too small for the label column, use the outer indent instead.
let continuation = if value_width > 0 {
formatter.continuation(Vec::new())
} else {
indent.into()
};
let options = RtOptions::new(available_width)
.subsequent_indent(continuation)
.word_splitter(textwrap::WordSplitter::NoHyphenation);
rendered.extend(lines.into_iter().flat_map(|line| {
let wrapped = word_wrap_lines([line.clone()], options.clone());
if wrapped
.iter()
.any(|line| line_width(line) > available_width)
{
// A wide grapheme may not fit after the continuation indent.
word_wrap_lines(
[line],
RtOptions::new(available_width)
.word_splitter(textwrap::WordSplitter::NoHyphenation),
)
} else {
wrapped
}
}));
rendered
}
}
impl HistoryCell for Arc<StatusHistoryCell> {
fn display_lines(&self, width: u16) -> Vec<Line<'static>> {
let available_inner_width = usize::from(width.saturating_sub(4));
if available_inner_width == 0 {
return Vec::new();
}
let lines = self.content_lines(width);
let content_width = lines.iter().map(line_width).max().unwrap_or(0);
let inner_width = content_width.min(available_inner_width);
let truncated_lines: Vec<Line<'static>> = lines
.into_iter()
.map(|line| truncate_line_to_width(line, inner_width))
.collect();
with_border_with_inner_width(truncated_lines, inner_width)
self.content_lines(width)
}
fn raw_lines(&self) -> Vec<Line<'static>> {
+3 -52
View File
@@ -1,7 +1,6 @@
use ratatui::prelude::*;
use ratatui::style::Stylize;
use std::collections::BTreeSet;
use unicode_segmentation::UnicodeSegmentation;
use crate::width::display_width;
@@ -14,7 +13,7 @@ pub(crate) struct FieldFormatter {
}
impl FieldFormatter {
pub(crate) const INDENT: &'static str = " ";
pub(crate) const INDENT: &'static str = " ";
pub(crate) fn from_labels<S>(labels: impl IntoIterator<Item = S>) -> Self
where
@@ -26,7 +25,7 @@ impl FieldFormatter {
.max()
.unwrap_or(0);
let indent_width = display_width(Self::INDENT);
let value_offset = indent_width + label_width + 1 + 3;
let value_offset = indent_width + label_width + 1 + 2;
Self {
indent: Self::INDENT,
@@ -74,7 +73,7 @@ impl FieldFormatter {
buf.push(':');
let label_width = display_width(label);
let padding = 3 + self.label_width.saturating_sub(label_width);
let padding = 2 + self.label_width.saturating_sub(label_width);
for _ in 0..padding {
buf.push(' ');
}
@@ -92,51 +91,3 @@ pub(crate) fn push_label(labels: &mut Vec<String>, seen: &mut BTreeSet<String>,
seen.insert(owned.clone());
labels.push(owned);
}
pub(crate) fn truncate_line_to_width(line: Line<'static>, max_width: usize) -> Line<'static> {
if max_width == 0 {
return Line::from(Vec::<Span<'static>>::new());
}
let mut used = 0usize;
let mut spans_out: Vec<Span<'static>> = Vec::new();
for span in line.spans {
let text = span.content.into_owned();
let style = span.style;
let span_width = display_width(text.as_str());
if span_width == 0 {
spans_out.push(Span::styled(text, style));
continue;
}
if used >= max_width {
break;
}
if used + span_width <= max_width {
used += span_width;
spans_out.push(Span::styled(text, style));
continue;
}
let mut truncated = String::new();
for grapheme in text.graphemes(/*is_extended*/ true) {
let grapheme_width = display_width(grapheme);
if used + grapheme_width > max_width {
break;
}
truncated.push_str(grapheme);
used += grapheme_width;
}
if !truncated.is_empty() {
spans_out.push(Span::styled(truncated, style));
}
break;
}
Line::from(spans_out)
}
+1 -1
View File
@@ -2,7 +2,7 @@
//!
//! This module turns protocol-level snapshots into stable display structures used by `/status`
//! output and footer/status-line helpers, while keeping rendering concerns out of transport-facing
//! code.
//! code. The status summary is borderless and wraps values without truncating paths or IDs.
//!
//! `rate_limits` is the main integration point for status-line usage-limit items: it converts raw
//! window snapshots into local-time labels and classifies data as available, stale, or missing.
@@ -4,15 +4,13 @@ expression: rendered
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Model: gpt-5.6-sol (reasoning none, summaries auto) │
│ Model provider: server-ollama │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Model: gpt-5.6-sol (reasoning none, summaries auto)
Model provider: server-ollama
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
Limits: data not available yet
@@ -4,18 +4,16 @@ expression: rendered
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.6-sol (reasoning none, summaries auto) │
│ Model provider: server-openai │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.6-sol (reasoning none, summaries auto)
Model provider: server-openai
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
Limits: data not available yet
@@ -4,20 +4,18 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 1.05K total (700 input + 350 output) │
│ Context window: 100% left (1.45K used / 272K) │
│ 5h limit: [████████░░░░░░░░░░░░] 40% left (resets 11:32) │
│ Weekly limit: [█████████████░░░░░░░] 65% left (resets 11:52) │
│ Warning: limits may be stale - start new turn to refresh. │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 1.05K total (700 input + 350 output)
Context window: 100% left (1.45K used / 272K)
5h limit: [████████░░░░░░░░░░░░] 40% left (resets 11:32)
Weekly limit: [█████████████░░░░░░░] 65% left (resets 11:52)
Warning: limits may be stale - start new turn to refresh.
@@ -4,20 +4,18 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 2K total (1.4K input + 600 output) │
│ Context window: 100% left (2.2K used / 272K) │
│ 5h limit: [███████████░░░░░░░░░] 55% left (resets 09:25) │
│ Weekly limit: [██████████████░░░░░░] 70% left (resets 09:55) │
│ Credits: Available │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 2K total (1.4K input + 600 output)
Context window: 100% left (2.2K used / 272K)
5h limit: [███████████░░░░░░░░░] 55% left (resets 09:25)
Weekly limit: [██████████████░░░░░░] 70% left (resets 09:55)
Credits: Available
@@ -4,19 +4,17 @@ expression: sanitized
---
/status
╭───────────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 1.2K total (800 input + 400 output) │
│ Context window: 100% left (1.2K used / 272K) │
│ Monthly credit limit: [██████████████░░░░░░] 68% left (resets 07:08 on 7 May) │
│ 8,000 of 25,000 credits used │
╰───────────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 1.2K total (800 input + 400 output)
Context window: 100% left (1.2K used / 272K)
Monthly credit limit: [██████████████░░░░░░] 68% left (resets 07:08 on 7 May)
8,000 of 25,000 credits used
@@ -4,20 +4,18 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ Session: 0f0f3c13-6cf9-4aa4-8b80-7d49c2f1be2e │
│ Forked from: e9f18a88-8081-4e51-9d4e-8af5cde2d8dd │
│ │
│ Token usage: 1.2K total (800 input + 400 output) │
│ Context window: 100% left (1.2K used / 272K) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Session: 0f0f3c13-6cf9-4aa4-8b80-7d49c2f1be2e
Forked from: e9f18a88-8081-4e51-9d4e-8af5cde2d8dd
Token usage: 1.2K total (800 input + 400 output)
Context window: 100% left (1.2K used / 272K)
Limits: data not available yet
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 1.2K total (800 input + 400 output) │
│ Context window: 100% left (1.2K used / 272K) │
│ Monthly limit: [██████████████████░░] 88% left (resets 07:08 on 7 May) │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 1.2K total (800 input + 400 output)
Context window: 100% left (1.2K used / 272K)
Monthly limit: [██████████████████░░] 88% left (resets 07:08 on 7 May)
@@ -4,19 +4,17 @@ expression: sanitized
---
/status
╭───────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning high, summaries detailed) │
│ Directory: [[workspace]] │
│ Permissions: Workspace (Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 1.9K total (1K input + 900 output) │
│ Context window: 100% left (2.25K used / 272K) │
│ 5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 3:14 AM) │
│ Weekly limit: [███████████░░░░░░░░░] 55% left (resets 3:24 AM) │
╰───────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning high, summaries detailed)
Directory: [[workspace]]
Permissions: Workspace (Ask for approval)
Agents.md: <none>
Token usage: 1.9K total (1K input + 900 output)
Context window: 100% left (2.25K used / 272K)
5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 3:14 AM)
Weekly limit: [███████████░░░░░░░░░] 55% left (resets 3:24 AM)
@@ -4,20 +4,18 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Server: Local background server │
│ │
│ Model: gpt-5.1-codex-max (reasoning medium, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Server: Local background server
Model: gpt-5.1-codex-max (reasoning medium, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
Limits: data not available yet
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭───────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Profile locked (read-only, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Context window: 100% left (0 used / 272K) │
│ Limits: data not available yet │
╰───────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Profile locked (read-only, Ask for approval)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
Context window: 100% left (0 used / 272K)
Limits: data not available yet
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭───────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Workspace (Approve for me) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Context window: 100% left (0 used / 272K) │
│ Limits: data not available yet │
╰───────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Workspace (Approve for me)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
Context window: 100% left (0 used / 272K)
Limits: data not available yet
@@ -4,17 +4,15 @@ expression: sanitized
---
/status
╭──────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ Account: Enterprise (Automation) │
│ │
│ Limits: data not available yet │
╰──────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Account: Enterprise (Automation)
Limits: data not available yet
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
Limits: data not available yet
@@ -4,19 +4,17 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ 5h limit: [███████████░░░░░░░░░] 55% left (resets 08:24) │
│ Weekly limit: [██████████████░░░░░░] 70% left (resets 08:54) │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
5h limit: [███████████░░░░░░░░░] 55% left (resets 08:24)
Weekly limit: [██████████████░░░░░░] 70% left (resets 08:54)
@@ -4,20 +4,18 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 1.9K total (1K input + 900 output) │
│ Context window: 100% left (2.25K used / 272K) │
│ 5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 03:14) │
│ Weekly limit: [████████████░░░░░░░░] 60% left (resets 03:34) │
│ Warning: limits may be stale - start new turn to refresh. │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 1.9K total (1K input + 900 output)
Context window: 100% left (2.25K used / 272K)
5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 03:14)
Weekly limit: [████████████░░░░░░░░] 60% left (resets 03:34)
Warning: limits may be stale - start new turn to refresh.
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ Limits: not available for this account │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
Limits: not available for this account
@@ -4,18 +4,16 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ Limits: not available for this account │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
Limits: not available for this account
@@ -4,21 +4,30 @@ expression: sanitized
---
/status
╭────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit │
│ https://chatgpt.com/codex/settings/usa │
│ for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: ガパガパガパガ │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspa │
│ Agents.md: <none> │
│ Account: ガパガパガパ@ex │
│ Thread name: ガパガパガパガ │
│ Collaboration mode: ガパ collaborat │
│ │
│ Limits: data not availa │
╰────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit
https://chatgpt.com/codex/settings/usage
for up-to-date
information on rate limits and credits
Model: ガパガパガパガ
パ-model (reasoning
none, summaries
auto)
Directory: [[workspace]]
Permissions: Custom (workspace
with network
access, Ask for
approval)
Agents.md: <none>
Account: ガパガパガパ
@example.com (ガパ
plan)
Thread name: ガパガパガパガパ
thread
Collaboration mode: ガパ collaboration
mode
Limits: data not available
yet
@@ -4,18 +4,18 @@ expression: sanitized
---
/status
╭────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning high, summaries de │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for │
│ Agents.md: <none> │
│ │
│ Token usage: 1.9K total (1K input + 900 output) │
│ Context window: 100% left (2.25K used / 272K) │
│ 5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 03:14) │
╰────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning high, summaries
detailed)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for
approval)
Agents.md: <none>
Token usage: 1.9K total (1K input + 900 output)
Context window: 100% left (2.25K used / 272K)
5h limit: [██████░░░░░░░░░░░░░░] 28% left (resets 03:14)
@@ -4,21 +4,19 @@ expression: sanitized
---
/status
╭─────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Server: unix:///tmp/codex-home/app-server-control/app-server- │
│ control.sock (v0.133.0) │
│ │
│ Model: gpt-5.1-codex-max (reasoning medium, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 750 total (500 input + 250 output) │
│ Context window: 100% left (750 used / 272K) │
│ Limits: data not available yet │
╰─────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Server: unix:///tmp/codex-home/app-server-control/app-server-
control.sock (v0.133.0)
Model: gpt-5.1-codex-max (reasoning medium, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 750 total (500 input + 250 output)
Context window: 100% left (750 used / 272K)
Limits: data not available yet
@@ -4,21 +4,20 @@ expression: sanitized
---
/status
╭──────────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for app │
│ Agents.md: <none> │
│ │
│ Token usage: 1.2K total (800 input + 400 output) │
│ Context window: 100% left (1.2K used / 272K) │
│ Usage limit: [█████████████░░░░░░░] 65% left │
│ (resets 07:08 on 7 May) │
│ Secondary usage limit: [██████████░░░░░░░░░░] 50% left │
│ (resets 07:08 on 8 May) │
╰──────────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for
approval)
Agents.md: <none>
Token usage: 1.2K total (800 input + 400 output)
Context window: 100% left (1.2K used / 272K)
Usage limit: [█████████████░░░░░░░] 65% left
(resets 07:08 on 7 May)
Secondary usage limit: [██████████░░░░░░░░░░] 50% left
(resets 07:08 on 8 May)
@@ -4,24 +4,28 @@ expression: sanitized
---
/status
╭────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit │
│ https://chatgpt.com/codex/settings/usage │
│ for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace │
│ Agents.md: <none> │
│ │
│ Token usage: 1.2K total (800 │
│ Context window: 100% left (1.2K u │
│ Monthly credit limit: 68% left │
│ (resets 07:08 on │
│ 7 May) │
│ 8,000 of 25,000 │
│ credits used │
╰────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit
https://chatgpt.com/codex/settings/usage for
up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max
(reasoning none,
summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace
with network access,
Ask for approval)
Agents.md: <none>
Token usage: 1.2K total (800
input + 400 output)
Context window: 100% left (1.2K
used / 272K)
Monthly credit limit: 68% left
(resets 07:08 on
7 May)
8,000 of 25,000
credits used
@@ -1,26 +1,25 @@
---
source: tui/src/status/tests.rs
assertion_line: 1825
expression: "format!(\"before:\\n{before}\\n\\nafter:\\n{after}\")"
---
before:
/ T R A N S C R I P T / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/status
╭──────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ Limits: refresh requested; run /status again shortly. │
╰──────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
Limits: refresh requested; run /status again shortly.
@@ -39,22 +38,20 @@ after:
/ T R A N S C R I P T / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/status
╭───────────────────────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ Visit https://chatgpt.com/codex/settings/usage for up-to-date │
│ information on rate limits and credits │
│ │
│ Model: gpt-5.1-codex-max (reasoning none, summaries auto) │
│ Directory: [[workspace]] │
│ Permissions: Custom (workspace with network access, Ask for approval) │
│ Agents.md: <none> │
│ │
│ Token usage: 0 total (0 input + 0 output) │
│ spark limit: │
│ 5h limit: [███████████░░░░░░░░░] 55% left (resets soon) │
│ Weekly limit: [██████████████░░░░░░] 70% left (resets later) │
╰───────────────────────────────────────────────────────────────────────────╯
>_ OpenAI Codex (v0.0.0)
Visit https://chatgpt.com/codex/settings/usage for up-to-date
information on rate limits and credits
Model: gpt-5.1-codex-max (reasoning none, summaries auto)
Directory: [[workspace]]
Permissions: Custom (workspace with network access, Ask for approval)
Agents.md: <none>
Token usage: 0 total (0 input + 0 output)
spark limit:
5h limit: [███████████░░░░░░░░░] 55% left (resets soon)
Weekly limit: [██████████████░░░░░░] 70% left (resets later)
next message
@@ -62,6 +59,8 @@ next message
Ctrl+Space select
↑/↓ to scroll · pgup/pgdn to page · home/end to jump
q close · f3 find · esc browse prompts
+77 -36
View File
@@ -59,7 +59,6 @@ use pretty_assertions::assert_eq;
use ratatui::prelude::*;
use std::sync::Arc;
use tempfile::TempDir;
use unicode_width::UnicodeWidthStr;
#[test]
fn stale_monthly_limit_marks_fresh_rolling_snapshot_stale() {
@@ -147,6 +146,7 @@ async fn test_config(temp_home: &TempDir) -> Config {
/*network_enabled*/ true,
))
.expect("set permission profile");
set_workspace_cwd(&mut config, test_path_buf("/workspace/tests").abs());
config
}
@@ -186,30 +186,12 @@ fn render_lines(lines: &[Line<'static>]) -> Vec<String> {
}
fn sanitize_directory(lines: Vec<String>) -> Vec<String> {
let frame_width = lines
.iter()
.find(|line| line.starts_with('╭'))
.map(|line| UnicodeWidthStr::width(line.as_str()));
lines
.into_iter()
.map(|line| {
if let (Some(frame_width), Some(dir_pos), Some(pipe_idx)) =
(frame_width, line.find("Directory: "), line.rfind('│'))
{
let prefix = &line[..dir_pos + "Directory: ".len()];
let suffix = &line[pipe_idx..];
let replacement = "[[workspace]]";
let content_width = frame_width.saturating_sub(
UnicodeWidthStr::width(prefix) + UnicodeWidthStr::width(suffix),
);
let mut rebuilt = prefix.to_string();
rebuilt.push_str(replacement);
let replacement_width = UnicodeWidthStr::width(replacement);
if content_width > replacement_width {
rebuilt.push_str(&" ".repeat(content_width - replacement_width));
}
rebuilt.push_str(suffix);
rebuilt
if let Some((prefix, value)) = line.split_once("Directory:") {
let padding = &value[..value.len() - value.trim_start().len()];
format!("{prefix}Directory:{padding}[[workspace]]")
} else {
line
}
@@ -846,16 +828,18 @@ async fn status_uses_server_provider_id_and_auth_requirement() {
sanitize_directory(render_lines(&composite.display_lines(/*width*/ 120))).join("\n");
assert_snapshot!("status_server_auth_required", rendered);
let wide_destinations: Vec<String> = composite
.display_hyperlink_lines(/*width*/ 120)
.into_iter()
.flat_map(|line| line.hyperlinks.into_iter())
.map(|link| link.destination)
.collect();
assert_eq!(
wide_destinations,
vec!["https://chatgpt.com/codex/settings/usage"]
);
for width in [42, 120] {
let destinations: Vec<String> = composite
.display_hyperlink_lines(width)
.into_iter()
.flat_map(|line| line.hyperlinks.into_iter())
.map(|link| link.destination)
.collect();
assert_eq!(
destinations,
vec!["https://chatgpt.com/codex/settings/usage"]
);
}
let narrow_destinations: Vec<String> = composite
.display_hyperlink_lines(/*width*/ 24)
@@ -1495,7 +1479,61 @@ async fn status_card_token_usage_excludes_cached_tokens() {
}
#[tokio::test]
async fn status_snapshot_truncates_in_narrow_terminal() {
async fn status_wraps_long_paths_and_session_ids_without_losing_text() {
let temp_home = TempDir::new().expect("temp home");
let mut config = test_config(&temp_home).await;
let directory = test_path_buf("/workspace/projects/界界/ガ゙/a-very-long-directory-name/codex");
set_workspace_cwd(&mut config, directory.abs());
let session =
ThreadId::from_string("00000000-0000-0000-0000-000000000123").expect("session id");
let usage = TokenUsage::default();
let (status, handle) = new_status_output_with_rate_limits_handle(
&config,
/*requires_openai_auth*/ true,
/*model_provider_id*/ None,
/*remote_connection*/ None,
/*account_display*/ None,
/*token_info*/ None,
&usage,
&Some(session),
Some("A thread with a long descriptive name".to_string()),
/*forked_from*/ None,
/*rate_limits*/ &[],
/*_plan_type*/ None,
Local::now(),
"gpt-5.5",
/*collaboration_mode*/ None,
/*reasoning_effort_override*/ None,
"<none>".to_string(),
/*refreshing_rate_limits*/ false,
);
let directory = directory.to_string_lossy();
for width in [7, 12, 17, 18, 24, 25, 40, 80] {
let lines = status.display_lines(width);
assert!(
lines.iter().all(|line| line.width() <= usize::from(width)),
"overwide row at width {width}: {:?}",
render_lines(&lines)
);
let joined = lines
.iter()
.map(|line| line.to_string().trim().to_string())
.collect::<String>();
assert!(
joined.contains(directory.as_ref()),
"path lost at width {width}: {joined}"
);
assert!(
joined.contains(&session.to_string()),
"session lost at width {width}: {joined}"
);
}
assert!(handle.copy_text().contains(directory.as_ref()));
assert!(handle.copy_text().contains(&session.to_string()));
}
#[tokio::test]
async fn status_snapshot_wraps_in_narrow_terminal() {
let temp_home = TempDir::new().expect("temp home");
let mut config = test_config(&temp_home).await;
config.model = Some("gpt-5.1-codex-max".to_string());
@@ -1560,11 +1598,11 @@ async fn status_snapshot_truncates_in_narrow_terminal() {
}
let sanitized = sanitize_directory(rendered_lines).join("\n");
assert_snapshot!(sanitized);
assert_snapshot!("status_snapshot_truncates_in_narrow_terminal", sanitized);
}
#[tokio::test]
async fn status_snapshot_truncates_halfwidth_kana_in_narrow_terminal() {
async fn status_snapshot_wraps_halfwidth_kana_in_narrow_terminal() {
let temp_home = TempDir::new().expect("temp home");
let mut config = test_config(&temp_home).await;
set_workspace_cwd(&mut config, test_path_buf("/workspace/tests").abs());
@@ -1596,7 +1634,10 @@ async fn status_snapshot_truncates_halfwidth_kana_in_narrow_terminal() {
let rendered_lines = render_lines(&composite.display_lines(/*width*/ 42));
let sanitized = sanitize_directory(rendered_lines).join("\n");
assert_snapshot!(sanitized);
assert_snapshot!(
"status_snapshot_truncates_halfwidth_kana_in_narrow_terminal",
sanitized
);
}
#[tokio::test]
+2 -1
View File
@@ -1,4 +1,5 @@
//! Update visible terminal-history tails without discarding terminal scrollback.
//! When the existing tail is an unchanged prefix, append only the new rows.
use super::Tui;
use crate::custom_terminal::Terminal as CustomTerminal;
@@ -66,7 +67,7 @@ where
let Ok(previous_rows) = u16::try_from(previous_rows) else {
return Ok(false);
};
if previous_rows == 0 || previous_rows > viewport.top() {
if previous_rows > viewport.top() {
return Ok(false);
}
@@ -105,6 +105,38 @@ fn inaccessible_history_tail_is_preserved_for_non_destructive_append() {
assert_eq!(terminal.backend().vt100().screen().contents(), before);
}
#[test]
fn appending_to_unchanged_history_tail_preserves_existing_rows() {
let width = 52;
let height = 8;
let backend = VT100Backend::new(width, height);
let mut terminal = Terminal::with_options(backend).expect("terminal");
terminal.set_viewport_area(Rect::new(
/*x*/ 0, /*y*/ 0, width, /*height*/ 2,
));
insert_history_lines(
&mut terminal,
vec![Line::from("/status"), Line::from("Account: business")],
)
.expect("insert initial status card");
let replacement = plain_hyperlink_lines(vec![Line::from("Thread usage: 50 credits")]);
assert!(
replace_visible_terminal_history_tail(
&mut terminal,
/*previous_lines*/ &[],
&replacement,
InsertHistoryMode::Standard,
HistoryLineWrapPolicy::PreWrap,
)
.expect("append late billing details")
);
assert_eq!(
terminal.backend().vt100().screen().contents(),
"/status\nAccount: business\nThread usage: 50 credits"
);
}
#[test]
fn replacing_soft_wrapped_history_counts_physical_terminal_rows() {
let width = 12;