From b367790d9b960e804e3f001457d0ea18f528e87d Mon Sep 17 00:00:00 2001
From: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com>
Date: Tue, 26 Aug 2025 17:34:24 -0700
Subject: [PATCH] fix emoji spacing (#2735)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
before:
after:
---
...t__tests__interrupt_exec_marks_failed.snap | 2 +-
codex-rs/tui/src/chatwidget/tests.rs | 2 +-
codex-rs/tui/src/history_cell.rs | 20 ++++++++++---------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap
index 7f15f49b..1554e94f 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap
@@ -3,4 +3,4 @@ source: tui/src/chatwidget/tests.rs
expression: exec_blob
---
>_
- ✗ ⌨️ sleep 1
+ ✗ ⌨️ sleep 1
diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rs
index 6f939c62..a92fb0e4 100644
--- a/codex-rs/tui/src/chatwidget/tests.rs
+++ b/codex-rs/tui/src/chatwidget/tests.rs
@@ -1246,7 +1246,7 @@ fn stream_error_is_rendered_to_history() {
let cells = drain_insert_history(&mut rx);
assert!(!cells.is_empty(), "expected a history cell for StreamError");
let blob = lines_to_single_string(cells.last().unwrap());
- assert!(blob.contains("⚠ "));
+ assert!(blob.contains("⚠\u{200A} "));
assert!(blob.contains("stream error:"));
assert!(blob.contains("idle timeout waiting for SSE"));
}
diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs
index f7c257d3..6d059a4c 100644
--- a/codex-rs/tui/src/history_cell.rs
+++ b/codex-rs/tui/src/history_cell.rs
@@ -230,14 +230,11 @@ fn pretty_provider_name(id: &str) -> String {
title_case(id)
}
}
-/// Return the emoji followed by a hair space (U+200A) and a normal space.
-/// This creates a reasonable gap across different terminals,
-/// in particular Terminal.app and iTerm, which render too tightly with just a single normal space.
-///
-/// Improvements here could be to condition this behavior on terminal,
-/// or possibly on emoji.
+/// Return the emoji followed by a hair space (U+200A).
+/// Using only the hair space avoids excessive padding after the emoji while
+/// still providing a small visual gap across terminals.
fn padded_emoji(emoji: &str) -> String {
- format!("{emoji}\u{200A} ")
+ format!("{emoji}\u{200A}")
}
/// Convenience function over `padded_emoji()`.
@@ -900,14 +897,19 @@ pub(crate) fn new_error_event(message: String) -> PlainHistoryCell {
// in terminals like Ghostty.
let lines: Vec> = vec![
"".into(),
- vec![padded_emoji("🖐").red().bold(), message.into()].into(),
+ vec![padded_emoji("🖐").red().bold(), " ".into(), message.into()].into(),
];
PlainHistoryCell { lines }
}
pub(crate) fn new_stream_error_event(message: String) -> PlainHistoryCell {
let lines: Vec> = vec![
- vec![padded_emoji("⚠").magenta().bold(), message.dim()].into(),
+ vec![
+ padded_emoji("⚠").magenta().bold(),
+ " ".into(),
+ message.dim(),
+ ]
+ .into(),
"".into(),
];
PlainHistoryCell { lines }