diff options
| author | sl0p <sl0p@sl0p.foo> | 2026-08-14 00:21:56 +0200 |
|---|---|---|
| committer | sl0p <sl0p@sl0p.foo> | 2026-08-14 00:21:56 +0200 |
| commit | f2f3d678495e37d2eee2d26f0f704f2accf451e1 (patch) | |
| tree | 4ee05f2c77cfe1d2d921e05cbd478cf9a1346236 /tests/test_drag.py | |
| parent | sl0ptty: select-to-copy, middle-click paste, and toasts (diff) | |
| download | slosh-f2f3d678495e37d2eee2d26f0f704f2accf451e1.tar.gz slosh-f2f3d678495e37d2eee2d26f0f704f2accf451e1.tar.xz slosh-f2f3d678495e37d2eee2d26f0f704f2accf451e1.zip | |
sl0ptty: the border is the button — click an edge to split toward it
The per-pane '+' is gone. It was one glyph for a verb with four directions, so
it always split into columns; it taxed every frame three columns of title
forever; and there were N of them on screen for one verb.
Clicking a pane's border now splits toward that border: the side you click is
the side the new pane appears on. Hovering arms the edge (it goes heavy) and
draws a dashed line exactly where the new boundary would land, so the gesture
explains itself and an idle frame stays quiet.
╭──────────────────── shell ─────────────────────╮
┃ ╎ │
┃ ╎ │ hovering the left
╰────────────────────────────────────────────────╯ border
│╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│ hovering the bottom
╰━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╯ border
The top border keeps its other job: a click splits upward, a drag moves the
pane. A press that never moves is a click, which is a distinction the drag
machine already had to make.
The guide has to be painted after the pane's content, not with the frame: the
dashed line crosses the terminal's own cells, and the first version was drawn
underneath them and was invisible.
Two old tests changed rather than the code, both because the gesture set is
better now: 'beside the split button' is a drag handle, and 'dropping a pane
on itself does nothing' is a click, which splits. The replacement asserts what
actually needs asserting — a drag that wanders and returns changes nothing.
387 checks green (360 headless + 27 live).
Diffstat (limited to 'tests/test_drag.py')
| -rw-r--r-- | tests/test_drag.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/test_drag.py b/tests/test_drag.py index 8dfbe8c..1fdd029 100644 --- a/tests/test_drag.py +++ b/tests/test_drag.py @@ -163,11 +163,15 @@ def test_drag_edge_cases(): before = [(p["id"], p["x"]) for p in s.panes()] left = s.panes()[0] - # a drag that ends where it started must change nothing + # a drag that wanders and comes back must change nothing. (A press and + # release with no motion is not this: that is a click, and a click on + # a border splits — see test_split_ux.py.) s.send(rf"\e[<0;{left['x'] + 5};{left['y'] + 1}M") + s.send(rf"\e[<32;{left['x'] + 20};{left['y'] + 4}M") + s.send(rf"\e[<32;{left['x'] + 5};{left['y'] + 1}M") s.send(rf"\e[<0;{left['x'] + 5};{left['y'] + 1}m") s.settle() - check("dropping a pane on itself does nothing", + check("a drag that returns to its origin changes nothing", [(p["id"], p["x"]) for p in s.panes()] == before, str(s.panes())) # a drag released over nothing (the gap ring) must not swap or crash @@ -184,13 +188,12 @@ def test_drag_edge_cases(): s.send("k") # any keystroke ends a drag s.settle(60) check("a keystroke ends an abandoned drag", s.api("alive")["alive"]) - snap = s.snapshot() - pos = snap.line(left["y"]).find("+") - if pos >= 0: - s.click(pos, left["y"]) - s.settle() - check("the mouse still works after a drag", len(s.panes()) == 3, - str(len(s.panes()))) + + # and a border click still works, which is the proof it is not wedged + s.click(left["x"], left["y"] + 2) + s.settle() + check("the mouse still works after a drag", len(s.panes()) == 3, + str(len(s.panes()))) def test_drop_target_is_visible(): |
