mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
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
This commit is contained in:
1 parent
cef3910ea4
commit
3725f02cf3
38 files changed
+1335
-245
No files matched your search
@@ -783,6 +783,16 @@ fn ps_output_long_command_snapshot() {
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ps_output_halfwidth_sound_marks_snapshot() {
|
||||
let cell = new_unified_exec_processes_output(vec![UnifiedExecProcessDetails {
|
||||
command_display: "echo ガパガパガパガパガパ".to_string(),
|
||||
recent_chunks: vec!["output ガパガパガパガパガパ".to_string()],
|
||||
}]);
|
||||
let rendered = render_lines(&cell.display_lines(/*width*/ 24)).join("\n");
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ps_output_many_sessions_snapshot() {
|
||||
let cell = new_unified_exec_processes_output(
|
||||
@@ -1653,6 +1663,44 @@ fn session_header_indicates_yolo_mode() {
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn session_header_aligns_halfwidth_sound_marks() {
|
||||
let cell: Box<dyn HistoryCell> = Box::new(SessionHeaderHistoryCell::new(
|
||||
"gpt-5-ガ-パ".to_string(),
|
||||
/*reasoning_effort*/ None,
|
||||
/*show_fast_status*/ false,
|
||||
PathBuf::from("project"),
|
||||
"test",
|
||||
));
|
||||
|
||||
let width = 80;
|
||||
let height = cell.desired_height(width);
|
||||
let area = Rect::new(0, 0, width, height);
|
||||
let mut buf = Buffer::empty(area);
|
||||
cell.render(area, &mut buf);
|
||||
|
||||
insta::assert_snapshot!("session_header_halfwidth_sound_marks", format!("{buf:?}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn session_header_truncates_halfwidth_directory() {
|
||||
let cell: Box<dyn HistoryCell> = Box::new(SessionHeaderHistoryCell::new(
|
||||
"gpt-5".to_string(),
|
||||
/*reasoning_effort*/ None,
|
||||
/*show_fast_status*/ false,
|
||||
PathBuf::from("ガパガパガパガパガパガパガパガパ-project"),
|
||||
"test",
|
||||
));
|
||||
|
||||
let width = 42;
|
||||
let height = cell.desired_height(width);
|
||||
let area = Rect::new(0, 0, width, height);
|
||||
let mut buf = Buffer::empty(area);
|
||||
cell.render(area, &mut buf);
|
||||
|
||||
insta::assert_snapshot!("session_header_halfwidth_directory", format!("{buf:?}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn yolo_mode_includes_managed_full_access_profiles() {
|
||||
let permission_profile: PermissionProfile = PermissionProfile::Managed {
|
||||
|
||||
Reference in new issue
Block a user