targets: an area follows the selection unless you pin it - #120
Open
zmaril wants to merge 1 commit into
Open
Conversation
powderman previewhttps://powderman-pr-120.fly.dev The workbench, live: split/join/swap areas, the F3 palette, the widgets, themes, tooltips, the status bar. On branches with the MCP server, point an agent at it: claude mcp add --transport http powderman-preview "https://powderman-pr-120.fly.dev/mcp"Updated on every push. Destroyed when this PR closes. |
The file browser could not open anything. It mounted the tree with no on_pick, so clicking a file selected the row inside that one editor and no other area heard — the only way to point a code viewer at a file was the chip and the modal picker. Which also made #109 nearly untestable: it marks the row an area is already open on, and almost nothing ever opened one. Blender's model, because it is the right one: an editor follows the active thing, and a pin freezes it. Pin is opt-out. `select { kind, value }` writes the target on every unpinned area whose editor points at that kind. Not resolved when an area is drawn — written into the layout — so the document still says exactly what each area shows and every reader of it, the target chip and get_state and a saved workspace, needs no new concept. `set_pinned { id, pinned }` is the freeze. Both are bus commands, so both got MCP tools, which the parity test asked for by name. `target_kind` is deliberately not `target_noun`. The noun is the word shown to a person; the kind is what an area points *at*. The code viewer and the diff viewer share one, so picking a file drives both — the Code and Changes arrangements, working. The file browser does not share it: its target is the folder it is rooted at, and re-rooting it onto the file you just clicked would collapse the tree you clicked it in. The pin is composed into every targeting editor's header rather than declared fourteen times, since it belongs to the act of looking at something rather than to any one editor. The half you split off keeps what it was showing — splitting is how you get a second view of *this* thing, and a fresh half that followed the next selection away would be the opposite of the gesture. `pinned` is serde(default), so every layout saved before it reads as unpinned, which is the behaviour those layouts had. There is a test with a real pre-pin document in it, because a default that came out the other way would silently freeze every existing workbench. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XjCx5QszLXroGYh1YBxybw
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.
Stacked on #117.
You were right that #109 was hard to tell apart from nothing. Here's why: the file browser could not open anything.
on_pickwas wired in exactly one place — the target-picker modal. So clicking a file selected the row inside that one editor and no other area heard. The only way to point a code viewer at a file was the chip and the modal. Which made #109 nearly untestable too: it marks the row an area is already open on, and almost nothing ever opened one.The model
Blender's, because it's the right one: an editor follows the active thing, and a pin freezes it. Pin is opt-out.
Writes the target on every unpinned area whose editor points at that kind. Not resolved at draw time — written into the layout, so the document still says exactly what each area shows and every reader of it (the target chip,
get_state, a saved workspace) needs no new concept.set_pinned { id, pinned }is the freeze.Both are bus commands, so both got MCP tools — the parity test asked for them by name.
target_kindis nottarget_nounThe noun is the word shown to a person. The kind is what an area points at.
filefolderrunchartcode and diff share one, so picking a file drives both — that's the Code and Changes arrangements finally working. The browser deliberately does not share it: its target is the folder it's rooted at, and re-rooting it onto the file you just clicked would collapse the tree you clicked it in. There's a test asserting the browser stays put.
Details worth knowing
selectis navigational, so a click in a list doesn't bury the splits and joins on the undo stack.pinnedisserde(default), so every layout saved before it reads as unpinned, which is what those layouts did. The test uses a real pre-pin document, because a default coming out the other way would silently freeze every existing workbench.Trying it
Open the Code workspace and click a file. Then Changes — same click, both panes. Pin the code viewer, click another file, watch only the diff move.
161 tests pass (5 new); fmt clean, clippy clean under
-D warnings,docs/reference.mdregenerated with the two new commands and tools.🤖 Generated with Claude Code
https://claude.ai/code/session_01XjCx5QszLXroGYh1YBxybw