Skip to content

fix(mecatui): normalize tabs before display layout - #2413

Merged
jbeda merged 2 commits into
mainfrom
fix/mecatui-reasoning-tab-wrap
Oct 18, 2026
Merged

jbeda merged 2 commits into
mainfrom
fix/mecatui-reasoning-tab-wrap

Conversation

@jbeda

@jbeda jbeda commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prevent tabs from widening terminal content after wrapping or truncation, which can make the session view scroll horizontally or cause bounded views to clip text.

  • Centralize tab expansion in cmd/mecatui/internal/terminaltext/tabs.go: ExpandTabs handles explicit fixed widths, and ExpandStyleTabs follows the effective Lip Gloss style policy.
  • Normalize tabs before layout in reasoning summaries, plain transcript cards, permission arguments/reasons, inventory and focus text, delegation titles, soul content, and saved-memory descriptions. Replace the existing tool-card-specific implementation with the shared helper.
  • Preserve the separation between display normalization, sanitization, and Markdown processing. Leave already-styled viewport input unchanged.
  • Document the shared helpers and final framed-width checks in docs/tui.md.

Cause and behavior

ANSI width/wrapping helpers do not account for Lip Gloss's later tab expansion. The indentation and assistant-rail budget was already correct, but expanding tabs after wrapping could widen the complete framed block; the reasoning regression reproduced 78 columns in a 60-column viewport.

Lip Gloss v2.0.6 also returns zero from GetTabWidth() for an unset style, despite rendering unset tabs as four spaces. The style-aware helper resolves the implicit default while preserving explicit zero (remove tabs) and negative (no conversion) settings. This avoids fixing overflow by accidentally deleting word separators.

Regression tests compare tabbed content against manually expanded input and check final rendered widths. Coverage includes default and explicit style policies, framing, terminal-width changes, title truncation, and real soul/saved-memory rendering paths. The added regression tests failed before the corresponding fixes.

Verification

On the current revision:

  • task test passed.
  • task lint passed.
  • task docs passed.
  • Focused race-enabled tests passed for the tab helpers, affected UI/blocks paths, reasoning, memory-description rails, plain transcript cards, and approval reasons.

On the initial reasoning-only revision:

  • go run ./cmd/mecademo passed, including tool calls, permission ask/approval, and final result.
  • task test:race passed on a full rerun. The initial run hit the existing scheduler flake TestFireProvisionalAdmissionDeadlineKeepsPendingUntilRecovery, tracked in CI: track flaky tests on main and PRs #2327 (item 7); five focused race-enabled repetitions also passed. No scheduler code changed. The full race suite has not been rerun after the shared-helper follow-up.

API compatibility

No wire/API, Go public API, or stored-data changes. This is a terminal-client rendering correction; no API major or feature identifier changes and no upgrade coordination are required.

jbeda and others added 2 commits October 18, 2026 13:33
Expand tabs using the text style's tab width before calculating wrapped reasoning rows so the assistant rail cannot widen the transcript past the viewport. Cover framed output across widths and resizes, and document the layout rule.

Co-authored-by: Mecatl <[email protected]>
Centralize fixed-width and style-aware tab expansion in terminaltext, accounting for Lip Gloss's unset tab-width getter behavior. Normalize affected plain-text wrapping and title truncation paths before layout, and verify text preservation and rendered widths.

Co-authored-by: Mecatl <[email protected]>
@jbeda jbeda changed the title fix(mecatui): expand reasoning tabs before wrapping fix(mecatui): normalize tabs before display layout Oct 18, 2026
@jbeda
jbeda merged commit 00acdb9 into main Oct 18, 2026
37 checks passed
@jbeda
jbeda deleted the fix/mecatui-reasoning-tab-wrap branch October 18, 2026 21:27
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
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