Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
iceteaSA
force-pushed
the
sidebar-rail
branch
from
September 4, 2026 23:11
fd6df6e to
4c256ba
Compare
The sidebar width was hardcoded to 42 in two independent places. It is now a single clamped source fed by the sidebar_width config key. The clamp enforces a minimum of 20 for legibility, a terminal-width-derived maximum of terminal width minus 40 to preserve main content, and a hard cap of 100.
iceteaSA
force-pushed
the
sidebar-rail
branch
from
September 13, 2026 05:25
4c256ba to
3ff522c
Compare
3 tasks
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.
Issue for this PR
Closes #40086
Stacked on #46117 (
sidebar_widthconfig). The first commit here is that PR's tip; review from98ab5979d4onward. I'll rebase once #46117 lands.Type of change
What does this PR do?
Adds a 2-column rail between the content and the sidebar: a
│divider with a handle glyph at the top —◂when expanded,▸when collapsed. Drag the rail to resize; click it (or<leader>b) to collapse or expand. Width and state persist across restarts.auto(shown when the terminal is wide),collapsed(rail only),hide. Click and<leader>bboth toggleauto↔collapsedand never writehide; a separatesession.sidebar.hidecommand does. In narrow terminals the toggle only opens the overlay and no longer persists state.clampSidebarWidth(20 … min(100, cols − 40)).session.sidebar.width.grow/.shrink(±4 cols) /.reset(removes the override), all unbound by default and reachable from the palette.sidebar: "auto" | "collapsed" | "hide"intui.jsonas the initial state; the persisted KV value wins after that.sidebar_widthfrom feat(tui): make the sidebar width configurable #46117 is the default the drag override sits on top of.OPENCODE_DISABLE_MOUSE/mouse: false): the rail and glyph still render, no handlers are attached, keyboard commands work.Why it's built the way it is:
dragevent (one cell over), so a narrow rail is never the captured target.mousedownis on the rail;drag/drag-endbubble up from wherever the cursor lands.kv.get/kv.setand a newkv.delete, notkv.signal—signalre-seeds its default into the store when the key is missing, which would make reset a no-op.width={1}border box places its child one column past itself; a 1-column rail put the glyph off-screen at the right edge. The rail+sidebar row hasflexShrink={0}because wrapping the sidebar in a row made it yoga-shrinkable under a wide content column. Both have position-asserting tests that render the production geometry.drag-endonly after a capture and may then re-dispatch theupto the rail, so drag-end clears the gesture first and the rail's up handler is a no-op without one — one state write per click, one width write per drag.How did you verify your code works?
packages/tui:bun test251 pass / 1 skip,bun typecheckclean.packages/opencodetypecheck clean.Ran the TUI from source over a PTY at 140×40 and 100×40 with injected SGR mouse events and checked
kv.jsonafter each step: drag both directions (one write per gesture), collapse and expand by click and by<leader>b, collapsed drag from the floor, restart persistence, reset (key removed, layout snaps back live), grow/shrink, mouse disabled (rail renders, drag inert, keyboard works), narrow overlay with no rail and no persisted state.Screenshots / recordings
Expanded, 140 columns (the rail is the
│◂left of the sidebar):Collapsed:
Checklist