Repository navigation
feat(app): drag a pane to move it within a session's splits - #173
Merged
Merged
Conversation
A pane's grip, shown over a strip at the middle of its top edge while the session has two panes or more, drags it with MyGo's in-window drag and drop onto another pane, which shows four drop zones; dropping splits that pane on the side nearest the pointer. The move keeps the pane's terminal and its place in the order the shells opened in, so its follower still reads its own shell. Esc cancels; a drop that would change nothing does nothing. Move pane items in the row's menu and four shortcuts without default keys swap the focused pane with a neighbor. Closes #169 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nMqJHsqtndDSqJDPp1qYv
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
Before this, the only way to rearrange a split session was to close panes and split again, which ends their shells. Now a pane can be dragged onto another one.
Element.Drag(paneDrag)on the grip,ui.DragOver/ui.Dropon each pane's box). A card with the pane's number, its title (or the session name) and the last line on its screen follows the pointer. The pane being dragged gets a darker veil. The pane under the pointer mutes its terminal and shows four zones: left and right strips, top and bottom bars. The zone is the side nearest the pointer (the pane split by its diagonals). It is filled in the accent color and reads "Drop on the right" / "放到右边". The other zones have dashed outlines and short names. Labels move out of the way of the card. Esc cancels.paneTree.moveremoves the pane (its sibling takes the room) and splits the target on the chosen side, 50/50. The dropped pane gets the focus. Two kinds of drop do nothing, and that zone does not light up: a drop on the pane itself, and a drop on the side of its sibling where it already is. The divider's share is kept in that case.removedrops the pane frompaneTree.order, somovesaves the order and puts it back.pick(monitor.ShellPick) goes by the order the shells opened in, so a moved pane's follower still reads its own shell, not the shell of whatever pane now sits where it was. The terminal objects are untouched.PointerPosition, which takes no input (the terminal inside is still the press target). The grip sits in aPassThroughrow and hasKeepFocus. Only the 40×10 pill itself takes presses. Selecting text and mouse reporting in a full-screen program work everywhere else, including the rest of the strip, and a test covers both. The grip is only built while the pointer is in the strip, so most of the time nothing extra is there at all.paneTree.swaptrades the focused pane with its neighbor in a direction. The session row's menu (paneMenu, the one function the menu uses) gets a "Move pane" submenu with "Swap with the pane on the left/right/above/below". The Shortcuts page gets four actions (movePaneLeft/Right/Up/Down) with no default keys. The free-looking candidates are all taken by something else: Alt+Shift+arrows (Windows Terminal resize), Cmd+Ctrl+arrows (Ghostty resize), Ctrl+Shift+arrows (select by word in editors).App.moving), Esc included. Without that, cancelling with Esc took the grip out of the next frame. That ended the press without a release, so the cancelled drag was never cleared and no later drag could start.Compared with the mockup
Matches: the grip pill at the top middle of the pane, the dashed left/right/top/bottom zones with 左/上/下, the highlighted right zone reading "放到右边", the card following the pointer, the dimmed source pane, and the ① | ② | ③ layout after the drop. Differences:
Testing
go fmt ./...(no changes),go build ./...,go vet ./...,GOOS=windows go vet ./...,GOOS=darwin go vet .,go tool mygo vet,go test -race ./...: all pass.TestPaneMove: moves onto each side of a pane check the tree, the focus, the unchangedorderand picks, and that a shell opened afterwards still counts after them. It also covers drops that change nothing (onto itself, onto the sibling's side, keeping the divider's share) and swapping, including at the edge.TestDropSide: the side nearest the pointer, andlastLine.TestDragPane(real tester and SSH test server): no grip with one pane, off the strip, or zoomed. Esc cancels a drag. A drop on itself does nothing. Drops on each side of another pane give the expected tree. Terminals stay the same objects, picks are unchanged, and the server has three shells. Input still reaches the right shell. A drag inside a pane selects and copies text. A click in the strip beside the grip reaches a program with mouse reporting asESC [M.TestMovedPaneFollowsItsShell: after a move, each pane still follows its own shell's folder through the stand-in follower.TestSwapPaneKeys: a bound Move pane key and the row menu's submenu swap panes.TestShortcutDefaultsis updated for the four actions without keys.TestDragPaneScreenshots: the grip on hover, a drag over the right side of pane ①, and the layout after the drop, in English and Simplified Chinese. Shots were checked against the mockup and are not committed.PointerPositionon mouse moves over a split pane cost in practice.Generated by Claude Code