Conversation
…worktree row The sidebar folder row handed the full row width to `truncate_left` and then prepended `"📂 "`, so the composed line ran ~3 display columns past the row width and the terminal clipped the tail — the final worktree segment a reviewer cares about (`wt/review` shown as `wt/rev`). The path ended up elided on the front (by truncate_left) AND clipped on the back. Reserve the prefix's true display width first, then left-truncate the path into the remaining budget so the composed `📂 <path>` line always fits the row and the trailing segment survives. Decisions: - Added `unicode-width` (already a workspace dep, used by shelbi-cli) to shelbi-tui and measure the emoji with `UnicodeWidthStr::width` rather than hardcoding 3. The existing `sidebar::display_width` is `chars().count()`, which under-counts the 2-cell emoji by a column and is the exact source of this class of bug — so I did not reuse it. - Extracted `folder_row_text()` so the fix is unit-testable against the composed emoji-prefixed line (not `truncate_left` in isolation, which is what let the original bug slip past its passing test). New test asserts display width <= row width AND the trailing `wt/review` segment survives across a range of narrow widths, plus that front elision still engages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jlong
deleted the
jlong/review-sidebar-folder-row-clips-the-worktree-name-off-the-end-prefix-width-not-reserved-before-truncation
branch
August 17, 2026 00:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
The review pane's sidebar folder row shows a worktree path that is elided on the front AND clipped on the back, so the final folder name — the one identifying part a reviewer cares about — is lost. Observed on the
contextstorereview pane: the row reads📁 ...els/ContextStore/.shelbi/wt/revfor the worktree/Users/jlong/Workspaces/32pixels/ContextStore/.shelbi/wt/review— the trailingreviewis cut torev.Current Behavior
crates/shelbi-tui/src/review_panel.rs,render_row,PanelRow::Folder(~line 633):truncate_leftis given the FULL rowwidthand correctly keeps the tail (...wt/review). But the rendered line then prepends"📂 "(a 2-cell emoji + a space ≈ 3 display columns). The composed📂 <label>line is now ~3 columns wider thanwidth, so ratatui / the terminal clips the RIGHT edge — eating the tail thattruncate_leftjust preserved. The path ends up elided on both ends and the worktree folder name is gone. The existingtruncate_leftunit test passes because it exercises the function in isolation, never the emoji-prefixed composed line.Expected Behavior
The folder row shows the worktree's final segment(s) intact — e.g.
📂 ...ContextStore/.shelbi/wt/review, ending inreview— front-elided with...only as needed, and the composed line (emoji + space + path) never exceeds the row width.Technical Details
Reserve the prefix's display width before truncating, e.g.:
Use the same unicode-width helper the TUI already uses elsewhere for column math (grep the crate for how other rows measure display width) rather than assuming 1 col/char — the emoji is the whole reason the current code overruns. Double-check the emoji renders as the assumed cell count in the target terminals; if width is ambiguous, reserve the safe (larger) value.
Note: the screenshot header shows
📁while the code uses📂; the fix is the same regardless of which folder glyph is used — reserve the prefix's actual display width.Acceptance Criteria
wt/review, never a clippedwt/rev).📂 <path>line's display width is ≤ the row width — no right-edge clipping of the tail....still happens when the (prefix-reserved) budget requires it.PanelRow::Folderat a narrow width and asserts (a) the rendered line's display width ≤ budget AND (b) it ends with the full final path segment — i.e. it exercises the composed emoji-prefixed line, not justtruncate_leftin isolation.truncate_leftbehavior/tests.Auto-opened by Shelbi — review at: /Users/jlong/.shelbi/projects/shelbi/tasks/review-sidebar-folder-row-clips-the-worktree-name-off-the-end-prefix-width-not-reserved-before-truncation.md