Arranging Panes: swap contents on a fixed floor plan, the Tray, Arrange mode (D87)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading ADR 0005 (docs/adr/0005-arranging-swaps-contents-on-a-fixed-floor-plan.md) and the D87 row plus round-log entry in docs/DESIGN-TREE.md; terms are defined in GLOSSARY.md. Wait for #31, which merges first as the baseline, since this spec supersedes #21's approach. The work starts with the size contact sheet (user story 65) before any drag, Tray or Arrange-mode code, so the first deliverable is that sheet for the owner to judge, not a patch.
由索引模型根据 Issue 内容生成。
描述
Spec for D87 (docs/DESIGN-TREE.md, the D87 row and the round log entry "Pane moving rethought"), ADR 0005
(docs/adr/0005-arranging-swaps-contents-on-a-fixed-floor-plan.md). Terms: GLOSSARY.md (Pane, Tray, Arrange mode,
Required Widget, Widget picker, Drop zone, Free tiling). Supersedes #21's approach; #31 merges first as the baseline.
Problem Statement
Rearranging Singularity's Panes feels janky from start to finish, worst on a small laptop display. Dropping a Pane
where you pictured it "feels almost impossible": while you drag, the whole app keeps reorganising itself and changing
shape, because one title drag both moves a Widget and reshapes the layout (a Pane's edges split it, the screen's edges
make a new column or row, and the layout reflows live to preview the hovered drop). A plain swap of two Widgets is the
smallest target on screen. On a small display most splits are refused for size, so the zones left jump around, and the
full-size floating Pane covers what you aim at. Adding a Widget means splitting and then finding it in a list that
feels like you must type its exact name. There is no way to set a Widget aside while you make room for it, and no way
to build a Design of your own from scratch. The owner compares it to the iOS home screen, where apps teleport around
when you don't want them to.
Solution
Separate the two jobs. A drag only moves contents: drop a Widget on another Pane and the two swap (or it fills an
empty Pane), or drop it on the Tray, where it waits. The floor plan (where the Panes' outlines are) changes only
by its own explicit edits: drag the line between two Panes, split a Pane (left, right, up or down), close a Pane. While
you drag, nothing moves except a highlight on the Pane under the pointer and a small chip with the Widget's name.
Rearranging happens in Arrange mode: the Tray shows, empty Panes say so, Panes get split and close buttons, a
one-line key legend sits at the bottom, and Done ends it once Home (the only Required Widget) has a Pane. A title drag
enters it, so a quick swap is still one gesture. Outside Arrange mode the app looks exactly as it does today and the
Tray is never visible.
A right-click on a Pane opens its menu: Replace widget… first, then Split (← → ↑ ↓), Close, Arrange. Replace
widget and Split both use the Widget picker: a palette-style list you can type into or scroll, Widgets not on screen
first and those on screen dimmed below a line (picking one swaps it here). New design… starts Arrange mode from one
empty Pane filling the screen, with Home waiting in the Tray.
Every Widget must look right at any Pane size, so the work starts with a size contact sheet the owner judges, and a
Widget in a Pane below its smallest size shows one clean line, needs 30 × 10.
User Stories
Moving contents
- As a user, I want to drag a Pane's title onto another Pane and have the two Widgets swap places, so that swapping two things is one easy gesture.
- As a user, I want nothing on screen to move while I drag except a highlight and a small chip, so that I can aim at a target that holds still.
- As a user, I want the Pane under the pointer to highlight the moment I reach it, so that I always know where the drop will land.
- As a user, I want the highlight to say what will happen ("swap with queue", "put here"), so that I don't have to guess.
- As a user, I want a release to land on whatever Pane is under the pointer, so that what I see is what I get.
- As a user, I want to drop a Widget into an empty Pane and have it fill that Pane, so that I can place things into space I made.
- As a user, I want to drop a Widget back on its own Pane (or press Esc) to cancel the drag, so that a mistaken grab costs nothing.
- As a user, I want the dragged Widget to follow the pointer as a small chip with its name, so that it doesn't cover the Panes I'm aiming at on a small display.
- As a user, I want a release the app never heard (over another window, after the focus moved) to put the Widget back, so that nothing is left stuck to the pointer.
- As a user, I want a right click during a drag to be ignored, so that it can't drop the Widget somewhere by accident.
- As a user, I want every drop to be allowed, even into a Pane smaller than the Widget likes, so that I never wonder why something won't go there.
The Tray
12. As a user, I want to drop a Widget on the Tray, leaving its Pane empty, so that I can set it aside while I make room for it.
13. As a user, I want to drag a Widget from the Tray onto any Pane, so that I can put it exactly where I want once the space is ready.
14. As a user, I want dropping a Tray Widget onto an occupied Pane to send that Pane's Widget into the Tray, so that nothing is lost in a swap.
15. As a user, I want × on a Pane to close it and send its Widget to the Tray while the neighbour fills the room, so that closing never destroys anything.
16. As a user, I want Clear Tray (and × on one Tray item) to remove Widgets I don't want, so that the Tray doesn't fill up with clutter.
17. As a user, I want Clear Tray to leave Home alone, so that I can't lose the one Widget the app needs.
18. As a user, I want the Tray to be kept per Design until I clear it, across restarts, so that a Widget I parked is waiting the next time I arrange.
19. As a user, I want the Tray to be invisible outside Arrange mode, so that normal use is uncluttered.
The floor plan
20. As a user, I want to make a Pane bigger by dragging the line between it and its neighbour, so that resizing is its own clear gesture.
21. As a user, I want a line dragged past its limit to stop at the furthest size that still fits, so that a fast fling doesn't stop short.
22. As a user, I want Panes to keep a minimum size when I drag a line, so that nothing collapses to nothing.
23. As a user, I want to split a Pane left, right, up or down, so that I can make room on whichever side I need.
24. As a user, I want a split to give me a new empty Pane and open the Widget picker on it at once, so that adding a Widget is: split, pick, done.
25. As a user, I want Esc in that picker to leave the new Pane empty and put me in Arrange mode, so that I can fill it later by dragging something in.
26. As a user, I want to make a Widget take a whole column by closing its neighbour and dragging the line, so that big changes are possible without the app reshaping itself.
Arrange mode
27. As a user, I want dragging a title to enter Arrange mode by itself, so that a quick swap needs no extra step.
28. As a user, I want to enter Arrange mode from the palette ("Arrange"), a Pane's menu or the m key, so that I can find it however I look.
29. As a user, I want empty Panes to say they are empty, so that I can see the space I have.
30. As a user, I want each Pane to show split and close buttons in Arrange mode, so that I can edit the floor plan with the mouse.
31. As a user, I want a one-line key legend at the bottom in Arrange mode, so that I can see the keys instead of memorising them.
32. As a user, I want Done to stay unavailable with a short line like "Home still needs a Pane" while Home is in the Tray, so that I can't leave a Design without its main Pane.
33. As a user, I want Esc to end Arrange mode (as Done), so that leaving is quick.
34. As a user, I want my edits to a built-in Design to keep working as today (naming prompt on the first edit, an unnamed "(edited)" slot, Reset design, undo/redo), so that the new model doesn't lose what already works.
The keyboard
35. As a keyboard user, I want arrows to move between Panes in Arrange mode, so that I can reach any Pane.
36. As a keyboard user, I want Enter to pick up the focused Widget (the chip shows), arrows to aim and Enter to swap, so that moving a Widget far away disturbs nothing on the way.
37. As a keyboard user, I want t to send the focused Widget to the Tray, so that setting something aside is one key.
38. As a keyboard user, I want s then an arrow to split the focused Pane that way, so that all four directions are two keys.
39. As a keyboard user, I want x to close the focused Pane, so that closing is one key.
40. As a keyboard user, I want +/- to move the focused Pane's line, so that I can resize without a mouse.
41. As a keyboard user, I want the same highlight and chip as the mouse, so that both ways look and behave alike.
The Pane menu and the Widget picker
42. As a first-time user, I want right-clicking a Pane's title to open its menu, so that the first thing I try works.
43. As a user, I want right-clicking a Pane's body to open the same menu where the body has no menu of its own, so that I don't have to hit the title exactly.
44. As a user, I want song rows, Cards and the queue to keep their own right-click menus, so that a right-click on a thing still acts on that thing.
45. As a user, I want Replace widget… to be first in a Pane's menu, so that swapping a Widget for another is the obvious action.
46. As a user, I want to click the Widget's name in a Pane's title, or press a key, to open the Widget picker, so that I have shortcuts once I know them.
47. As a user, I want the Widget picker to be a list I can type into or scroll, like the palette, so that I can see every option without knowing its name.
48. As a user, I want Widgets not on screen listed first, so that the likely choices are at the top.
49. As a user, I want Widgets already on screen listed dimmed below a line, and picking one to swap it into this Pane, so that "I need the queue here" works even when the queue is elsewhere.
50. As a user, I want a replaced Widget to simply leave the screen, so that replacing doesn't leave junk behind (it's still in the picker).
51. As a user, I want Home's Pane to have no Replace widget, so that I can't remove the main Pane by accident.
52. As a user, I want each Widget at most once on screen, so that two copies can't fight over the same state.
53. As a user, I want the palette to offer Replace widget… and Split left/right/up/down, so that everything is also reachable by typing.
Required Widgets
54. As a user, I want only Home to be required in a Design of my own, so that I can build a minimal layout without the library, queue or lyrics.
55. As a user without a library Pane, I want the palette's "Your Library" to open my library as a popup, so that Liked Songs and my playlists are still reachable.
56. As a user without a queue Pane, I want the palette's "Queue" to open the queue as a popup, so that I can still see and reorder it.
57. As a user without a lyrics Pane, I want nothing else to change, so that leaving lyrics out is free.
58. As a user, I want the built-in Designs to keep Home, the library, the queue and lyrics, so that the defaults stay complete.
New design
59. As a user, I want "New design…" in the palette to start Arrange mode from one empty Pane filling the screen, with Home in the Tray, so that I can build a Design from a blank slate.
60. As a user, I want to shape the floor plan first (split, drag lines) and then fill the Panes, so that I can plan space before content.
61. As a user, I want a "+ Widget" button on the Tray that opens the Widget picker, so that I can add any Widget to the Tray and place it from there.
62. As a user, I want Done to ask for a name and save it as a Design of my own with the current Theme, so that my creation lands next to the built-ins.
63. As a user, I want Esc on New design… before anything is placed to leave my current Design untouched, so that trying it costs nothing.
Scaling
64. As a user, I want every Widget to look right at any Pane size, because with a hand-built floor plan odd sizes are common.
65. As the owner, I want a contact sheet per Widget at a fixed set of Pane sizes on both tiers, so that I can judge scaling cell by cell instead of asking for vague "improve it" passes.
66. As the owner, I want the sheet to include a small 13-inch laptop's terminal sizes (full screen and a half-screen window, Retina cells) emulated, so that I don't need the laptop to judge them.
67. As the owner, I want each cell I mark bad to become a fix with that exact cell as its before/after, so that fixes are concrete and don't regress other sizes.
68. As the owner, I want lyrics and Karaoke first on the sheet, so that the worst-scaling Widgets are fixed first.
69. As a user, I want a Widget in a Pane below its smallest size to show one dim centred line, needs 30 × 10, so that it's clear without over-explaining.
70. As a user, I want a Pane too small even for that line to show just the Widget's name in its title, so that tiny Panes stay clean.
71. As a user, I want the black hole's shape rule to become its "needs" size, so that it behaves like every other Widget.
Saved Designs
72. As a user, I want my existing saved Designs to keep loading exactly as before, so that the change doesn't lose my layouts.
73. As a user, I want empty Panes and the Tray to be saved with my Design, so that I can stop halfway and come back.
Implementation Decisions
Order (each a ticket, built in a fresh session; the owner tests after the Widget picker and after Arrange mode):
- Merge #31 (the pointer-path replayer, unheard releases end a drag, right click ignored mid-drag, a divider flung
past its limit stops at the furthest fit, resize mid-drag, the shared pointer-combining code). Its drop-zone, dwell
and preview parts stay until step 5 removes them. - Panes get their own identity (prefactor). Today a Pane is its Widget's name: the floor plan's leaves are
Widget names, and focus, hit boxes, the Design titles and many checks ("is Home focused?") use that name for both.
An empty Pane and the Tray can't be expressed that way. The floor plan's leaves become Panes with a stable identity
holding a Widget or nothing; the Widget and the Pane become two distinct types the compiler keeps apart (no bare
strings for either). Focus is a Pane; questions about what's focused ask the focused Pane's Widget. Per-Widget state
(scroll, Visual settings) stays keyed by Widget, so it follows the Widget when it moves. Saved Designs: the old
format (leaves named by Widget) still loads, each leaf becoming a Pane holding that Widget; the new format is written
on the next save. No user-visible change in this step: everything looks and behaves as before, so the existing
tests and pty scenarios must pass unchanged except where they name the types. - Size contact sheet (pty scenario): every Widget at a fixed set of Pane sizes (tiny 20×6, narrow-tall, wide-short,
medium, big, full screen) on the cell and pixel tiers, and full-terminal shots at the PC's size and an emulated
13-inch laptop (about 180×54 full screen and 90×50 half, Retina cell pixels; pinned later withstty size). Each
Widget declares its smallest size; below it, theneeds W × Hline. The owner marks cells; the bad ones become
tickets, lyrics and Karaoke first. Keep established looks (memory and D-rows): change only what the owner marked. - Widget picker and the Pane menu: right-click title/body menu (Replace widget…, Split ← → ↑ ↓ as one row, Close,
Arrange), the picker (palette-style list, on-screen Widgets dimmed below a line, picking one swaps), Split creates an
empty Pane and opens the picker, palette actions (Replace widget…, Split left/right/up/down, Your Library and Queue
popups when they have no Pane). Replaces today's split Widget list. No duplicates. Works before Arrange mode exists
(Esc from a split's picker leaves the Pane empty; until step 5 an empty Pane just shows as empty). - Arrangement and Arrange mode: one deep module, Arrangement, holding the floor plan, which Widget is in which
Pane, and the Tray. Its interface is the edits: swap two Panes' Widgets, Widget to the Tray, Tray to a Pane, split a
Pane on a side, close a Pane (its Widget to the Tray), move a line (clamped to the furthest fit), replace a Pane's
Widget, clear the Tray (Home stays), and the check that Done is allowed (Home placed). Every edit keeps the floor
plan valid (no Pane under the Pane minimum) and each Widget at most once; it says why when an edit can't happen.
The App's drag becomes: press on a title enters Arrange mode and holds the Widget; the chip follows the pointer;
the Pane (or Tray) under the pointer highlights at once; release drops there. Removed: edge and screen-edge
drop zones, live reflow, the dwell rule, the full-size floating Pane and the motion springs for reflow. Arrange
mode's look: Tray strip at the bottom edge (only in Arrange mode), empty Panes labelled, split/close buttons, key
legend, Done. The Tray is saved per Design with the floor plan. Undo/redo cover Arrangement edits. - New design…: Arrange mode from one empty Pane with Home in the Tray, "+ Widget" on the Tray, Done names it
(existing naming prompt), Esc before any edit leaves the current Design. - Keyboard in Arrange mode (replaces Move mode): arrows move between Panes, Enter picks up / Enter swaps,
t,
s+ arrow,x,+/-, Esc; Move mode's Shift+arrow splits go;menters Arrange mode.
Other decisions:
- Home is the only Required Widget for Designs of your own; built-in Designs keep D43's four.
- The popup rules hold (CLAUDE.md): the Pane menu and the Widget picker are
Popupvariants; Arrange mode is a layer
inApp::layers; the Tray scrolls if it holds more than fits. - Linux and macOS behave the same; no OS-specific code.
- Smoothness of the drag (the chip's motion, the highlight) is iterated after the owner's test; keep established looks
of the frame and the lit grip.
Testing Decisions
- Good tests drive the app the way a person does and check what they'd see or what they'd end up with; they don't
reach into private state. Red before green for each behaviour. - The App, through real keys and pointer events (rendered to a test terminal), is the main seam: drags onto a
Pane, an empty Pane and the Tray; right-click menus on title and body (and that rows, Cards, queue keep theirs); the
picker (ordering, the dimmed on-screen section, swap on pick); Split in four directions opening the picker; Arrange
mode entering/leaving, Done refused while Home is in the Tray; keyboard keys. Prior art: the Pane-moving tests
(scripted steps) and the popup tests (each Popup opened, drawn on top, Esc and clicks). - Whole pointer paths with #31's replayer (test clock, frame pacer, combined moves; mouse and trackpad hands;
every Design × sizes): on every path the floor plan stays valid, the drop lands on the Pane highlighted at release,
nothing stays held after the button comes up, and nothing but the highlight and chip changes during a drag. - Arrangement on its own: each edit, and a property test of random edit sequences over every Design and many
terminal sizes (no Pane under its minimum, each Widget at most once, Tray contents conserved by swaps, Home never
lost by Clear Tray). Prior art: the free-tiling property test (random 60-step sequences over every Design and
7 sizes) and the divider property tests. - Saved Designs: every existing saved file format loads to the same screen as before (prior art: the tree
survives TOML exactly); a Design with empty Panes and a Tray round-trips. - pty screenshots: the contact sheet; the chip, highlight, Tray, empty Pane,
needs W × H, legend; a full
arrange session (drag to Tray, split, fill, Done). Visual checks happen in the pseudo-terminal before a ticket closes. - The prefactor (step 2) is covered by the existing suite passing unchanged plus the old-format load test.
Out of Scope
- Duplicate Widgets (maybe later for Visuals such as the oscilloscope or starfield).
- Divider dragging outside Arrange mode stays as it is today (it already works); no other change to resizing.
- Touchpad scrolling (#32, after this), the main Pane's page as one value (#27).
- The second architecture round on the large UI files.
- Fixing every scaling problem in one go: the contact sheet decides which cells get fixed.
Further Notes
- The root cause is recorded in ADR 0005: reshaping on hover is the iOS "apps teleport around" problem; contents and
floor plan are separated so that the floor plan holds still. - The owner prefers the mouse; the keyboard way was "a bit more solid in its limitations", which is why it keeps the
pick up → aim → drop shape (no carrying a Widget through others, which would shuffle them). - After this: a #27 session, then
/improve-codebase-architectureround 2.
- 主要语言
- Rust
- 星标
- 0
- 派生
- 0
- 平均合并
- 3 小时 30 分钟
- 30 天内合并 PR
- 25
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
publicusr/singularity 的其他 Issue
-
enhancement ready-for-agent
难度 2/5 1-3 小时 新手友好度 65/100
publicusr/singularity#55 ·
维护者通常 1 天内回复
-
ready-for-agent
难度 2/5 1-3 小时 新手友好度 72/100
publicusr/singularity#17 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 28/100
publicusr/singularity#62 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
publicusr/singularity#61 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 30/100
publicusr/singularity#60 ·
维护者通常 1 天内回复
查看 publicusr/singularity 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
topgrade-rs/topgrade#2540 ·
维护者通常 1 天内回复
-
Invalid JSON options for ngram and edge_ngram silently use defaults可能已有人在做 @Tilendlesa 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
noemaforge/vimanam#153 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复