cmux-tui: a left dock undocks on the left (cx-x7pl)
Undocking the agent chat dock put the chat on the far right of the strip, even though it was docked on the left. The dock is created by moving the chat tab into a new column pinned to the left edge. With no anchor column, move-tab-to-column appends the new column after the last one and then pins it. The dock draws on the left, but its place in the column order is last, so clearing the pin scrolled it in on the right.
A column that a tab move pins to the left edge now leads the column order, so undocking it puts it first in the strip, on the left where it was shown. Right, top and bottom docks keep their place. Columns pinned with set-column-dock aren't moved.
A left dock made before this change is still last in the column order, so it still undocks on the right until it's docked again.
The other half of cx-x7pl, the drop ring staying on screen after a drop, is fixed in #18925.
Verification
a_tab_moved_into_a_left_dock_undocks_on_the_left (cmux-tui CLI test, real daemon over its socket) moves a tab into a new left-docked column, undocks it with set-column-dock, and requires that column to lead the strip. Run with scripts/verify-cmux-tui-hosted.sh --filter a_tab_moved_into_a_left_dock_undocks_on_the_left:
- Red at f189c04e370f (test only):
the undocked chat column must lead the strip: [8, 7, 12], so the chat column (12) came last. - Green at 87a7b4ac85cf (fix): passed, https://github.com/manaflow-ai/cmux/actions/runs/38017762224.
Not tried in the app with a live chat dock.
Changelog
- Fixed: undocking the agent chat dock puts it on the left of the strip, not the right.
Captures
- Native before/after (archive): cx-x7pl left undock. A tab moved into a new left dock column, then Undock Column: before, it moves to the far right; after, it stays on the left.
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes the agent chat dock undocking on the wrong side: a left-docked column now leads the column order, so undocking it scrolls it in on the left where it was shown, instead of on the far right.
- Left docks created before this change keep their old order and still undock on the right until docked again.
- Right, top, and bottom docks are unaffected; columns pinned with
set-column-dockaren't moved. - Adds a CLI test that moves a tab into a new left-docked column, undocks it, and requires it to lead the strip.
[!NOTE]
Low Risk
Localized layout-order adjustment only when creating a left dock via tab drag; covered by a new daemon integration test.
Overview
Fixes left-docked columns created via move-tab-to-column appearing at the far right of the strip after undock. New columns were still appended last in layout_columns while drawing on the left, so clearing the dock scrolled them in on the wrong side.
After pinning a left dock during tab drag in apply_tab_drag, the new column is moved to index 0 in the column list and the layout projection is synced. Other dock edges and set-column-dock pinning are unchanged; existing left docks keep their old order until re-docked.
Adds a Unix CLI integration test that docks a tab on the left, undocks with set-column-dock, and asserts the column leads the strip.
Reviewed by Cursor Bugbot for commit 21435b39c5c6deb987d479a6c5fc78c0f685413f. Bugbot is set up for automated code reviews on this repo. Configure here.