Skip to content

fix(tui): improve terminal compatibility and add minimum size guard#1

Merged
Fabio-RibeiroB merged 1 commit intoFabio-RibeiroB:mainfrom
bradymd:main
Mar 23, 2026
Merged

fix(tui): improve terminal compatibility and add minimum size guard#1
Fabio-RibeiroB merged 1 commit intoFabio-RibeiroB:mainfrom
bradymd:main

Conversation

@bradymd
Copy link
Copy Markdown

@bradymd bradymd commented Mar 23, 2026

Summary

  • Broader ANSI regex: the previous pattern only matched CSI sequences; updated to also cover OSC, SS3, and other escape types that were leaking into rendered output
  • Minimum terminal size guard: renders a friendly message instead of a broken layout when the terminal is smaller than 60×12
  • Preview line normalization: strips \r and expands \t before truncating, preventing control characters from appearing in session previews
  • Rune-aware truncation: replaces byte-indexed slicing with []rune slicing so multibyte (e.g. UTF-8 emoji/CJK) characters are never split mid-codepoint

Test plan

  • Resize terminal below 60 wide or 12 tall — should see the "Terminal too small" message
  • Resize back above threshold — layout should restore normally
  • Open a session that emits OSC or other non-CSI escape sequences — confirm they don't appear as raw escape bytes in the preview
  • Open a session whose output contains tabs or \r — confirm preview lines look clean

🤖 Generated with Claude Code

- Broaden ANSI escape regex to match OSC, SS3, and other sequences
- Show a friendly error when terminal is smaller than 60x12
- Normalize \r and \t in preview lines before truncation
- Fix string slicing to be rune-aware (prevents broken multibyte chars)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Fabio-RibeiroB Fabio-RibeiroB merged commit 45c74da into Fabio-RibeiroB:main Mar 23, 2026
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.

2 participants