opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Fix TUI ASCII rendering in tmux and add regression coverage

Open steipete opened this issue 1 month ago • 2 comments

Summary

  • automatically enable ASCII rendering whenever OpenTUI runs inside tmux (with an override via OPENCODE_TUI_ASCII)
  • stream frames through a small helper that decodes getRealCharBytes output, making tmux captures readable again
  • add a regression test around the helper to keep the decoding pathway honest
  • refresh docs/tui-debug.md with the latest ASCII-mode tips: auto-enable behaviour, capture advice, and cleanup checklist

Testing

  • bun test --filter ascii
  • tmux new-session -s ascii 'cd /Users/steipete/Projects/opencode && OPENCODE_TUI_ASCII=1 OPENCODE_TUI_NO_ALT_SCREEN=1 bun dev'

steipete avatar Nov 04 '25 04:11 steipete

For trivia reference @thdxr called for it and @steipete the author of Just Talk To It took it to himself (rightfully) and answered. I said it all so that I can ask @steipete to go the extra mile and also share his codex session please.

image

sJJdGG avatar Nov 04 '25 06:11 sJJdGG

So this was a bit of a detour since I forgot to update and had a very old version checked out that still used go. Since the Issue I tried to fix was already fixed, I salvaged the work I made to make opencode easier to debug via tmux. This fallback code now uses a scrappy ascii renderer. Might be worth moving some of that code to opentui, but it's good to test for now and should make future debug sessions with agents MUCH eassier.

steipete avatar Nov 04 '25 19:11 steipete