Files
codex/codex-rs/tui/src/line_truncation_tests.rs
T
Charlie Marsh 3725f02cf3 Fix TUI layout for halfwidth Japanese sound marks (#35962)
## What changed

- Use Ratatui-compatible terminal widths throughout TUI layout, preserving
  full-width counters for long lines.
- Wrap and truncate on grapheme boundaries so halfwidth kana sound marks and
  emoji sequences stay intact.
- Apply the corrected sizing to text input, selection popups, status and
  history cells, Markdown, hyperlinks, and scrollable cloud diffs.

## Testing

- Add focused unit and snapshot coverage for wrapping, truncation, cursor and
  mask alignment, popup columns, status output, session headers, Markdown
  tables, process output, and scrollable diffs.

GitOrigin-RevId: 294ec0bcff743c6bb16d55ec26308524ce741879
2026-07-29 14:01:31 +00:00

20 lines
496 B
Rust

use super::line_width;
use super::truncate_line_to_width;
use pretty_assertions::assert_eq;
use ratatui::text::Line;
#[test]
fn halfwidth_sound_marks_stay_with_their_grapheme_when_truncated() {
let line = Line::from("abガc");
assert_eq!(line_width(&line), 5);
assert_eq!(
truncate_line_to_width(line.clone(), /*max_width*/ 3),
Line::from("ab")
);
assert_eq!(
truncate_line_to_width(line, /*max_width*/ 4),
Line::from("abガ")
);
}