Skip to content

fix(tui): clip host display names by terminal columns - #4203

Merged
mvschwarz merged 1 commit into
mvschwarz:mainfrom
Vaishnavi220506:Vaishnavi220506/fix-host-label-terminal-width
Nov 30, 2026
Merged

mvschwarz merged 1 commit into
mvschwarz:mainfrom
Vaishnavi220506:Vaishnavi220506/fix-host-label-terminal-width

Conversation

@Vaishnavi220506

@Vaishnavi220506 Vaishnavi220506 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What a user gets

Host display names now fit the explorer's available terminal columns without splitting a grapheme. For example, 東京開発機 previously produced a 17-column label in a 13-column budget, and clipping 👩‍💻station could leave a partial joined emoji. Reuse the existing columns and columnIndex helpers while reserving space for the host identity and reachability suffix.

How you verified it

Tested commit 41960cead4773c670bef85bb7e8e42dcc1abad86 on Windows, Node 24.14.1:

  • The new tests on base f2fe3e529 failed in four cases: three wide labels and the joined emoji.
  • npx vitest run packages/tui/test/host-label-width.test.ts packages/tui/test/terminal-safe-text.test.ts packages/tui/test/emoji-truncation.test.ts — 25 passed.
  • npm run build — passed.
  • npm run lint — passed.
  • git diff origin/main...HEAD --check — passed.
  • npm test — incomplete: repository script checks reported failures in unchanged packaging/policy/POSIX-oriented checks, and the run stopped making progress and was interrupted. Workspace suites were not reached.

Anything you were unsure about

Rendering is verified through deterministic unit tests; no native terminal session was exercised. As before, the command identity and reachability suffix are retained when they alone exceed the available width.

If this is security-related

N/A.

  • One concern per PR; no version bump; no CHANGELOG.md edit
  • Tests added or updated where the change is testable
  • I listed the checks I ran, their results, and any checks I could not run

Summary by CodeRabbit

  • Bug Fixes
    • Host labels now fit the available terminal width more accurately, including names with wide characters and emoji.
    • Command identity remains visible when there is no room for a display name.
  • Tests
    • Added coverage for host label clipping and fitting across different host states.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

hostExplorerLabel now measures available space in terminal columns and clips display names by column position. Tests cover clipping across host reachability states, joined emoji, fitting names, and cases with no room for a display name.

Changes: Host label width handling

Layer / File(s) Summary
Column-based label clipping
packages/tui/src/topology/host-label.ts, packages/tui/test/host-label-width.test.ts
hostExplorerLabel measures the host name, suffix, and display name in terminal columns. It uses columnIndex to clip the display name and retains the existing fallback when no display name fits. Tests cover reachability states, joined emoji, and fitting names.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: aschenbath, openrig-review

Merge Risk: Minimal · up to 41960

Host labels in the explorer now clip display names by terminal width instead of string length, so wide characters and emoji should no longer overflow or be split. No concrete issue was found, and the targeted tests, build and lint were reported as passing. The risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: host display names in the TUI explorer are now clipped by terminal display columns instead of JavaScript string length. The raw summary confirms that hostExplorerLabel…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: host display names in the TUI explorer are now clipped by terminal display columns instead of JavaScript string length. The raw summary confirms that hostExplorerLabel switched to column-based width calculation with columnIndex, and the added tests cover clipping for wide names and joined emoji. The title uses the conventional fix(scope) form and is specific enough for a teammate scanning history.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e865878b-3284-4ef6-ad8b-5a25a9ee1737
Commits

Reviewing files that changed from the base of the PR and between dbf9a3a and 41960ce.

Files selected for processing: 2

  • packages/tui/src/topology/host-label.ts
  • packages/tui/test/host-label-width.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@openrig-review openrig-review left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving the reviewed head 41960ce to start the macOS package tests. A host's display name in the explorer is now measured and clipped by terminal columns with the existing column helpers, so a wide name like 東京開発機 fits its budget and a joined emoji isn't split, with the host identity and reachability suffix still reserved. Thank you, @Vaishnavi220506.

@mvschwarz mvschwarz moved this to In Progress in OpenRig roadmap Nov 30, 2026
@mvschwarz
mvschwarz merged commit 7a3094e into mvschwarz:main Nov 30, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRig roadmap Nov 30, 2026
@mvschwarz

Copy link
Copy Markdown
Owner

Thanks, @Vaishnavi220506, this is merged into main now. The TUI explorer measures and clips a host's display name by terminal columns, with the TUI's existing column helpers, so a wide name like 東京開発機 fits its space and a joined emoji isn't split, while the host identity and reachability suffix keep their room. Thanks for the clear before-and-after and a fix that needed no changes. It's on main and not yet in a published release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants