diff options
| author | user <user@clank> | 2026-08-14 14:59:20 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-14 14:59:20 +0200 |
| commit | 6d85e816e3c2ca7ae5dab958f5eef5f5763a959c (patch) | |
| tree | 3572143deb19da7b437b36e91dac1bc3252e29de /tests/test_drag.py | |
| parent | sl0ppty: the resize gap says it is a handle (diff) | |
| download | slosh-6d85e816e3c2ca7ae5dab958f5eef5f5763a959c.tar.gz slosh-6d85e816e3c2ca7ae5dab958f5eef5f5763a959c.tar.xz slosh-6d85e816e3c2ca7ae5dab958f5eef5f5763a959c.zip | |
sl0ppty: the resize hint names the verb
The dotted line said "this is a handle" and left what pulling it would do to
be worked out from the fact that it sits between two panes. An arrow in the
middle of the line says it outright.
It points along the axis the boundary *moves*, not the one it is drawn on: a
divider between two columns is a vertical line that travels sideways, and the
travelling is the half worth showing. So a column boundary gets a sideways
arrow and a row boundary an up-down one, which is the opposite of the line
each is drawn with and the right way round for the gesture.
Always bold, in both states, because it is the one cell of the hint that is
meant to be read; the line around it carries whether you are hovering or
holding.
Double arrows rather than U+2194 and U+2195. Those carry emoji presentation
and are widely rendered double-width, and screen_text books every chrome glyph
as exactly one cell, so one that drew as two would shift the rest of the row —
the same trap the split-guide arrows had to avoid. U+21D4 and U+21D5 have no
emoji form, and happen to rhyme with the doubled line the active state already
uses.
Diffstat (limited to 'tests/test_drag.py')
| -rw-r--r-- | tests/test_drag.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/test_drag.py b/tests/test_drag.py index 36fa83d..b6a4cfa 100644 --- a/tests/test_drag.py +++ b/tests/test_drag.py @@ -217,6 +217,7 @@ def test_drop_target_is_visible(): GRIP_V, GRAB_V = "\u250a", "\u2551" # dotted / doubled, vertical boundary GRIP_H, GRAB_H = "\u2508", "\u2550" # dotted / doubled, horizontal boundary +ARROW_V, ARROW_H = "\u21d4", "\u21d5" # which way that boundary travels def test_the_gap_says_it_is_a_handle(): @@ -311,6 +312,61 @@ def test_no_resize_hint_during_another_drag(): s.settle(80) +def test_the_gap_names_the_verb(): + """The dots say it is a handle; the arrow says what pulling it does.""" + with Session(SH, cols=120, rows=26) as s: + s.settle() + s.key("\\\\") + s.settle(200) + left, right = s.panes() + gx, gy = left["x"] + left["w"], left["y"] + 3 + + s.send(rf"\e[<35;{gx + 1};{gy + 1}M") + time.sleep(0.35) + s.settle(60) + snap = s.snapshot() + check("hovering a column boundary shows a sideways arrow", + ARROW_V in snap.screen(), "") + # A divider between columns is drawn vertically and travels sideways; + # the useful half of that is the travelling. + check("and not the up-down one", ARROW_H not in snap.screen(), "") + + pos = snap.find(ARROW_V) + check("the arrow sits in the middle of the boundary", + pos and pos[1] == left["y"] + left["h"] // 2, str(pos)) + check("on the line itself, inside the gap", + pos and left["x"] + left["w"] <= pos[0] < right["x"], str(pos)) + + s.send(rf"\e[<0;{gx + 1};{gy + 1}M") + s.send(rf"\e[<32;{gx + 5};{gy + 1}M") + s.settle(80) + check("it stays while the boundary is actually moving", + ARROW_V in s.snapshot().screen(), "") + s.send(rf"\e[<0;{gx + 5};{gy + 1}m") + s.settle(120) + check("and goes with the rest of the hint", + ARROW_V not in s.snapshot().screen(), "") + + +def test_a_row_boundary_names_its_own_verb(): + with Session(SH, cols=120, rows=26) as s: + s.settle() + s.key("-") + s.settle(200) + top, bottom = s.panes() + gx, gy = top["x"] + 6, top["y"] + top["h"] + + s.send(rf"\e[<35;{gx + 1};{gy + 1}M") + time.sleep(0.35) + s.settle(60) + snap = s.snapshot() + check("a row boundary shows an up-down arrow", + ARROW_H in snap.screen() and ARROW_V not in snap.screen(), "") + pos = snap.find(ARROW_H) + check("in the gap between the rows", + pos and top["y"] + top["h"] <= pos[1] < bottom["y"], str(pos)) + + if __name__ == "__main__": test_keyboard_resize() test_vertical_resize() @@ -323,4 +379,6 @@ if __name__ == "__main__": test_the_hint_changes_while_resizing() test_a_horizontal_boundary_uses_horizontal_marks() test_no_resize_hint_during_another_drag() + test_the_gap_names_the_verb() + test_a_row_boundary_names_its_own_verb() sys.exit(report()) |
