Repository navigation
feat(tui): collapse the sidebar from its version row - #481
Merged
Merged
Conversation
The sidebar is a fixed 28 columns of short labels. On a narrow terminal those columns are worth more to the chat, so the version row now carries a collapse glyph on its right edge, and the collapsed panel leaves a one-column strip with a restore glyph. The two glyphs are » and ‹: both Neutral in every width table and one cell wide, so a terminal that resolves ambiguous width as wide cannot re-measure them and shift the rail out of its column. sidebarCollapsed is a preference, not a layout fact. sidebarWidth still returns 0 on a frame too narrow to hold the panel, so restoring the preference does not force a sidebar into a frame that cannot take one, and a collapse request there leaves the layout as it was. The version row keeps its whole string: the glyph goes in the panel's own right-hand padding rather than out of the label's budget. Aiming it at innerW truncated pi-go 1.4.2+a1b2c3d to pi-go 1.4.2+a1b2c… — losing exactly the diagnostic that row is topmost to show. Signed-off-by: pi <dimetron@me.com>
rex owns the terminal layout and hunk draws the diff; neither calls the other. The skill records the sequence that actually places a pane where it was asked for: split with --keep-open --focus=false -c $PWD --json, then rex move BLOCK DIRECTION ANCHOR. --split=left alone is relative to the anchor block's position, so it lands on the wrong side as readily as the right one. Also records the traps: hunk diff is a full-screen TUI and must never run in the agent's own shell, and an api call takes one JSON object, not block_id=/args= flags. The registry test asserts every bundled skill is embedded and carries a description long enough to be actionable — an empty one registers a skill nothing will load. Signed-off-by: pi <dimetron@me.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #481 +/- ##
==========================================
- Coverage 91.50% 91.50% -0.01%
==========================================
Files 394 394
Lines 50610 50649 +39
==========================================
+ Hits 46313 46345 +32
- Misses 4291 4298 +7
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
codecov/patch flagged two lines: the guard against a click above the frame, and the width floor where collapsing is refused. The above-the-frame case only proves anything in the collapsed state. The strip's hit test is `row < topSectionRows`, and a negative row satisfies it, so without the guard a click in the scrollback just above a collapsed strip restores the panel. The expanded test is `row == 0`, which rejects -1 by accident — a first attempt at this test passed with the guard deleted, so it was asserting nothing. Signed-off-by: pi <dimetron@me.com>
Owner
Author
govulncheck
9 findings, all in
This PR adds no dependencies — it touches |
dimetron
added a commit
that referenced
this pull request
Nov 17, 2026
The sidebar had three ways to disappear after #479 and #481 merged: a frame at or below 80 columns dropped it outright, a portrait frame dropped it outright, and the version-row toggle collapsed it to a strip. Two of those left no control behind, so on exactly the frames that needed the columns back the sidebar became a one-way trip — no strip, no glyph, nothing to click. They are now one rule with one output. sidebarFits answers whether this frame can afford SidebarWidth columns: too narrow for the chat beside it, or portrait, and it cannot. sidebarWidth turns that plus the user's toggle into a width — SidebarWidth or the one-column strip — and never returns 0. The strip is one column, which every frame that can draw a chat can seat, so the sidebar is never absent, only wide or narrow, and the control that undoes a collapse is always on screen. The rule fires on resize and is a pure function of the frame, not a stored "already applied" flag. A cached flag would be one edit away from going stale, and a stale one shows the expanded panel on a phone. sidebarExpanded carries the one piece of state a render cannot re-derive: the user clicking the strip on a small frame to expand it, which the rule would otherwise undo on the very next frame. A resize clears it, which is the moment the user is asking for the layout to be decided again. The toggle now flips the visible state rather than the preference flag. On a small frame the strip is up because the rule collapsed it, with the flag still false — flipping only the flag there left the strip up and the control apparently dead. Five tests encoded the old hide-it contract (mainWidth at 60 columns, the symmetric-gap row helper, the absent-strip case, and the width floor) and were updated to the new one. Signed-off-by: pi <dimetron@me.com>
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.
What
The sidebar's version row gets a collapse control: click
»and the 28-columnpanel becomes a one-column strip carrying
‹; click the strip and it comes back.The chat takes the columns immediately, with the transcript re-wrapped for the
new width rather than waiting for the next resize.
Also widens the sidebar 23 → 28, and bundles a
rex-hunk-diffskill.Why the width change is in the same PR
At 23 columns the branch row read
⎇ feat/sidebar-…— cut exactly where it sayswhich work is in progress. 28 leaves a 19-character branch name whole, which
covers this repo's
feat/<topic>andfix/<topic>names. It costs the chat 5of 160 columns.
Both changes are about the same trade: what the sidebar's columns are worth. A
collapse control is the answer when the user wants all of them back; a wider
panel is the answer when they want the labels legible.
Design notes
sidebarCollapsedis a preference, not a layout fact.sidebarWidth()returns
SidebarWidthexpanded,SidebarStripWidthcollapsed, and0when theframe is too narrow to hold either. So restoring the preference on a 70-column
terminal does not force a sidebar into a frame that cannot take one, and a
collapse request there leaves the layout alone.
mainWidthderives fromsidebarWidth, so there is one place the frame's widths come from.The glyphs are width-safe.
»and‹are Neutral in every width table andone cell wide. An ambiguous-width glyph would be drawn two cells wide by a
terminal configured that way, shifting the rail and the chat a column left at the
exact moment the panel was collapsed.
The version keeps its whole string. The first attempt placed the glyph within
innerWand truncatedpi-go 1.4.2+a1b2c3dtopi-go 1.4.2+a1b2c…— spendingthe diagnostic the row is topmost to show on a button. The glyph now sits in the
panel's own right-hand padding, outside
innerW.Hit targets are whole rows. The expanded target is the version row, not the
glyph cell; the collapsed target is the strip's full height. Neither can overlap
the chat: both require a column at or past the chat panel's right edge.
The skill
internal/extension/bundled_skills/rex-hunk-diffdocuments opening a live Hunkdiff in a pane beside the agent. Two things it records because the first attempt
failed on them:
rex split --split=leftis relative to the anchor block's position, so itlands on the wrong side as readily as the right one. Placement is
rex move BLOCK DIRECTION ANCHOR.com.superlogical.terminal.resizetakes one JSON object, notblock_id=… args=….It is bundled rather than added to
.claude/skills/because**/.claude/isgitignored in this environment — a skill written there dies with the worktree.
Verification
go build ./...go test ./internal/tui ./internal/extensionmake lintmake vetGuards were seen red before green:
hitSidebarTogglein the click dispatcher → the click test failsmainWidthignore the collapsed width → the width and frame-integrity tests failTestBundledSkillsRegisteredfailsTestBundledSkillsCarryADescriptionfailsNot verified visually: the
»in a live 81+ column terminal. The rex windowused for testing caps panes at ~80 columns and pi needs >80 for the sidebar, so
the glyph and the untruncated branch were confirmed through
RenderSidebaranda test frame, against the real binary but not a real wide terminal.