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_layout.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_layout.py')
| -rw-r--r-- | tests/test_layout.py | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/tests/test_layout.py b/tests/test_layout.py index 97744d3..df79877 100644 --- a/tests/test_layout.py +++ b/tests/test_layout.py @@ -153,24 +153,18 @@ def test_hit_list(): snap.hit_at(pane["content_x"], pane["content_y"]) == f"pane:{pane['id']}", str(snap.hit_at(pane["content_x"], pane["content_y"]))) - # the split button, on the pane's own frame row — not the status bar's - # "+tab", which is a different verb and deliberately looks different - row = snap.line(pane["y"]) - pos = (row.index("+"), pane["y"]) if "+" in row else None - check("split button is drawn", pos is not None, str(snap.line(pane["y"]))) - if pos: - x, y = pos - check("the click target is exactly where the glyph is", - snap.hit_at(x, y) == f"split:{pane['id']}", str(snap.hit_at(x, y))) - # the rest of the top row is the drag handle, not the button - check("beside the button is not the button", - snap.hit_at(x - 1, y) == f"title:{pane['id']}", - str(snap.hit_at(x - 1, y))) - - s.click(x, y) - s.settle() - check("clicking the button splits", len(s.panes()) == 2, - str(len(s.panes()))) + # the border is the split target now; the top row is also the drag + # handle, which is why it reports title: rather than border: + check("the top border is the drag handle", + snap.hit_at(pane["x"] + 4, pane["y"]) == f"title:{pane['id']}", + str(snap.hit_at(pane["x"] + 4, pane["y"]))) + check("the side border is a split target", + snap.hit_at(pane["x"], pane["y"] + 2) == f"border:{pane['id']}:l", + str(snap.hit_at(pane["x"], pane["y"] + 2))) + check("the bottom border too", + snap.hit_at(pane["x"] + 4, pane["y"] + pane["h"] - 1) + == f"border:{pane['id']}:b", + str(snap.hit_at(pane["x"] + 4, pane["y"] + pane["h"] - 1))) def test_click_focuses_and_forwards(): |
