Skip to content

fix(dashboard): stop top bar flicker from frame overflow - #38

Merged
tomfordweb merged 1 commit into
mainfrom
fix/dashboard-flicker
Jul 29, 2026
Merged

fix(dashboard): stop top bar flicker from frame overflow#38
tomfordweb merged 1 commit into
mainfrom
fix/dashboard-flicker

Conversation

@tomfordweb

Copy link
Copy Markdown
Owner

Fixes the SIDEMUX top bar flashing in and out of the dashboard.

Root cause

The frame is built to exactly the terminal height with zero slack. visibleWidth counted JS chars, not terminal columns, so preview lines containing wide glyphs (CJK, emoji, ambiguous-width symbols from captured panes) rendered wider than the terminal, auto-wrapped, grew the frame by a row, and scrolled the top bar off screen. Preview content changes every refresh tick, so the banner flickered.

Changes

  • Autowrap off (?7l) for the dashboard session: overwide lines clip instead of wrapping, so the frame can never scroll. Restored on close.
  • Synchronized output (?2026) around each repaint plus alternate screen (?1049): no blank flash between clear and redraw, and shell scrollback survives quitting.
  • Column-aware width math: visibleWidth/truncate/wrapLines/pad now use a simplified wcwidth (CJK/emoji = 2 columns, combining marks/variation selectors = 0). wrapLines strips ANSI before slicing so wrap points can't land inside an escape sequence, with a guard so a double-width char that doesn't fit still consumes input.

Testing

  • New unit tests: CJK preview wraps by columns; emoji preview never grows the frame past the requested height.
  • Full local gate green: typecheck, lint, test, build.

Closes sidemux-2a7

Three causes, three fixes:

- Disable terminal autowrap for the dashboard session so an overwide
  line clips instead of wrapping. The frame is built to exactly the
  terminal height, so a single wrapped line scrolled the SIDEMUX top
  bar off screen; wide glyphs in captured pane content made this
  intermittent (banner flashing in and out).
- Wrap each repaint in synchronized-output brackets (?2026) and run on
  the alternate screen: no blank flash between clear and redraw, and
  the shell scrollback survives quitting the dashboard.
- Measure widths in terminal columns, not JS chars: visibleWidth,
  truncate, wrapLines, and pad now use a simplified wcwidth (CJK and
  emoji are 2 columns, combining marks and variation selectors are 0).
  wrapLines also strips ANSI before slicing so a wrap point can no
  longer land inside an escape sequence.

Closes sidemux-2a7
@tomfordweb
tomfordweb merged commit aedb4bb into main Jul 29, 2026
1 check passed
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.

1 participant