TUI layout misalignment with emoji/wide glyphs due to string-length-based padding/truncation
Resolved 💬 1 comment Opened Feb 9, 2026 by mikesigs Closed Feb 9, 2026
What version of Codex CLI is running?
0.98.0
What subscription do you have?
Pro
Which model were you using?
_No response_
What platform is your computer?
Windows
What terminal emulator and version are you using (if applicable)?
Windows Terminal w/Powershell 7 (pwsh)
What issue are you seeing?
When output includes emoji or other wide glyphs (e.g., ⚙, 💰, 🔢), columns and padded fields become misaligned. This indicates width calculations are based on JS string length/code units rather than terminal display cell width.
What steps can reproduce the bug?
- Render/pad/truncate lines containing mixed ASCII + emoji, e.g.: 💰 🔢 ⚙
- Align with fixed-width labels/columns using naive padding/truncation.
- Observe drift/overlap in adjacent content and broken alignment.
What is the expected behavior?
- Columns remain aligned regardless of emoji/wide glyphs.
- Truncation cuts by display width, not code unit count.
- Some glyphs consume 2 terminal cells, but logic treats them as 1 “char”.
- Padded/truncated text overflows or visually collides with nearby content.
Additional information
Technical Cause
- Terminal uses cell-width rendering (
wcwidthbehavior). - JS
.lengthdoes not represent rendered width. - Grapheme clusters + variation selectors + ZWJ sequences worsen mismatch.
Suggested Fix
- Introduce a display-width utility (wcwidth-compatible) for all layout math:
- truncation
- horizontal spacing/alignment
- Use grapheme-aware iteration where relevant.
- Add regression tests with:
- ASCII only
- CJK full-width chars
- emoji (⚙, 💰, 🔢)
- variation selectors (⚙️)
- mixed strings in constrained widths
Impact
Medium-high UX impact for TUI users: dashboards look broken/unstable with common glyph/icon usage.
Notice the overlap with the cog and the comma
<img width="358" height="96" alt="Image" src="https://github.com/user-attachments/assets/0a2fc6f7-fb9f-4f35-a191-45aed2f3d722" />
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗