Skip to content

fix(tui): add plain font style fallback#337

Open
kupendrav wants to merge 2 commits into
1jehuang:masterfrom
kupendrav:codex/issue-330-tui-font-modifier-safe-mode
Open

fix(tui): add plain font style fallback#337
kupendrav wants to merge 2 commits into
1jehuang:masterfrom
kupendrav:codex/issue-330-tui-font-modifier-safe-mode

Conversation

@kupendrav

Copy link
Copy Markdown

Fixes #330

Testing:

  • cargo check --package jcode-tui --lib --message-format short
  • cargo test --package jcode-tui --lib tui::ui::font_style_tests::strip_font_variant_modifiers_preserves_ascii_symbols -- --exact
  • git diff --check

This does not look like message data corruption. The regression test keeps the exact ASCII text browser continue Done Built in the buffer, then removes only terminal font style modifiers. The symbols remain unchanged.

That points to a terminal/font rendering problem: some styled glyph variants are missing or rendered as boxes. This patch adds an opt-in fallback:

JCODE_TUI_PLAIN_FONT_STYLE=1

When enabled, the final TUI frame strips bold/dim/italic/reverse modifiers before Ratatui writes the buffer, avoiding bad font variants while preserving text, colors, layout, and transcript data.

Copilot AI review requested due to automatic review settings June 7, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an opt-in “plain font style” mode for the TUI by stripping certain font-variant modifiers (bold/dim/italic/reversed) from the rendered buffer when an environment variable is set.

Changes:

  • Introduces JCODE_TUI_PLAIN_FONT_STYLE environment flag parsing.
  • Post-processes the frame buffer to remove selected ratatui Modifiers when enabled.
  • Adds a unit test ensuring symbol contents are preserved while modifiers are stripped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/jcode-tui/src/tui/ui.rs
Comment thread crates/jcode-tui/src/tui/ui.rs Outdated
Comment thread crates/jcode-tui/src/tui/ui.rs
Comment thread crates/jcode-tui/src/tui/ui.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI renders many characters as corrupted/garbled glyphs

2 participants