Skip to content

feat(tui): add mouse-drag sidebar resize#23738

Draft
eggfriedrice24 wants to merge 1 commit into
anomalyco:devfrom
eggfriedrice24:contrib/issue-6087
Draft

feat(tui): add mouse-drag sidebar resize#23738
eggfriedrice24 wants to merge 1 commit into
anomalyco:devfrom
eggfriedrice24:contrib/issue-6087

Conversation

@eggfriedrice24
Copy link
Copy Markdown

@eggfriedrice24 eggfriedrice24 commented Apr 21, 2026

Issue for this PR

Closes #6087

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Makes the TUI right sidebar resizable by dragging its left edge. The sidebar width was previously hard-coded to 42 columns in sidebar.tsx and referenced again in routes/session/index.tsx; there was no way to change it short of patching the binary.

Behavior:

  • 1-col resize handle sits at the sidebar/chat boundary. Idle: invisible (same bg as the panel). Hover/drag: highlighted in theme.warning (same yellow used by the permission prompt triangle, for visual consistency).
  • Mouse drag adjusts width live; the persisted value is written once on drag-end, not on every pixel, to avoid thrashing the kv.json disk writes.
  • Width clamped to [20, min(80, floor(terminal_width / 2))] - the dynamic upper bound prevents the sidebar from swallowing the chat on borderline-wide terminals (~120 cols).
  • Persisted via the existing kv.signal under sidebar_width, survives restarts.
  • Resize UI only appears in wide (inline) mode - in narrow/overlay mode the sidebar floats over the chat, where resizing has no meaning.

This picks up the design from #5917 (mouse-drag, width-persist, 20–80 clamp, 1px handle) which @agustif got a thumbs-up for from the team before it auto-closed at 60 days stale. The codebase had drifted too much (kv.signal refactor, no-floating-promises rule, etc.) for a clean rebase, so this is a fresh implementation with the same UX. @agustif is credited via Co-Authored-By on the commit.

Previous attempts:

Opening as draft per CONTRIBUTING.md's design-approval expectation on UI features - happy to flip to ready-for-review once approved, or close if you'd prefer to discuss the design more on #6087 first.

How did you verify your code works?

  • bun run typecheck passes clean (tsgo, cache-bypassed full run)
  • bunx oxlint on the changed files: 0 new warnings (19 baseline → 19 after)
  • Ran locally with bun dev . - hovering the sidebar/chat boundary highlights the handle yellow, drag resizes, value persists across restarts. Tested at 120/160/200 terminal widths; dynamic clamp keeps chat readable.

Screenshots / recordings

21.16.49_21-04-2026.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-Authored-By: Agusti F. <6601142+agustif@users.noreply.github.com>
@agustif
Copy link
Copy Markdown

agustif commented Apr 26, 2026

ty for picking this back up hope this time gets merged!

@liao666brant
Copy link
Copy Markdown

This feature seems useful, how is it going now?

@eggfriedrice24
Copy link
Copy Markdown
Author

eggfriedrice24 commented Apr 26, 2026

Your design did the heavy lifting, appreciate the original work and the doc trail you left on #5917. Now we wait on maintainer review; happy to address anything they want changed.

@eggfriedrice24
Copy link
Copy Markdown
Author

eggfriedrice24 commented Apr 26, 2026

Draft, waiting on maintainer design approval per CONTRIBUTING.md. Code is ready and verified locally, nothing pending on my side.

@notchrisbutler
Copy link
Copy Markdown

@thdxr Hi Dax! Any chance this could get a peek? Would love this..

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.

Is it possible to make the width of the sidebar configurable?

4 participants