summaryrefslogtreecommitdiff
path: root/test/snapshots
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 17:01:35 -0300
committerGabriel Schneider <[email protected]>2026-10-29 19:38:53 -0300
commit2cce341e2c94fb3150dc1f3e7911c26502a70487 (patch)
treec637fcfa9a52aa66f6c34600f4cdea4020088e01 /test/snapshots
parentc2b4f235e78735102c691677f08bd1b2403168df (diff)
downloadpardes-2cce341e2c94fb3150dc1f3e7911c26502a70487.tar.gz
pardes-2cce341e2c94fb3150dc1f3e7911c26502a70487.zip
views: several clients on one session, each its own layout, focus, cursors and scroll over the panes they share; a second `pardes --attach` draws on its own terminal beside the first, and `pardes-gui --attach` opens another window
The core still sees one view, the live one, in the fields it always had (src/views.zig): a view's share of the session (`views.fields`: its screen, columns, rects, focus, pointer and gestures, jumps, key prefixes, column tags, presentation and animations, windowed and native_images) and of each pane (`PaneView`: its place in the layout, which text has the keyboard, the body's cursor, selections and mode, its scroll, a document's size, what the step measured of it) is copied out when another view goes live and back when it is live again. One view never parks: the single client pays a test of one byte a step. `toView`, `openView` and `closeView` are taped inputs; the pump draws each other view by going into it and back, which leaves every digested field as it was, so the replica that draws nothing skips it. A parked view is in no digest (its slot is written whenever it goes out); what drawing it made of its own (animations, presentation) is kept, whatever its unpark brought inside a changed text is done again when it is next live. Shared: the panes' text, terminals, tags, prompts, messages, registers (yanked in one view, put in another), the workspace tag and settings. A terminal shown at two sizes takes the size of the view that typed into it last (`Pane.sized_by`), and any view's once that one is gone; the others show it at that size. A text edited in one view moves the other views' cursors and scroll with the splice, as a Zerox twin's (File.ParkedPlaces). A pane closed in one view leaves the others' layouts (by its slot's serial); a pane focused in a view that does not show it is placed in its active column (views.show). tty: each terminal is a Screen of its own (its vaxis, input reader, frame answer, kitty images and shm probe, glide, trail and flash); its input reaches the loop as its view's (a `from` ahead of it when another terminal posted last, so one terminal posts none). A SIGWINCH asks every terminal its size; a SIGHUP asks each whether it hung up or lost its stub. Detach, or a terminal's end, with other views left closes only that view, its stub told `d`; the session's end tells every stub. daemon.zig: an attach names an attached session too (or the only one there is when none is detached). gui: the Gui holds the live window's share of itself (window_fields: the SDL window and its presenting, scroll, glide, scene and post chain, pointer, blink, captures); the others wait in Shell.windows, swapped in (`follow`) as the core's live view changes, and each SDL event first takes its window's view live (`route`). Closing a window while others stay closes its view. Harnesses: `start <rows> <cols> views=N` in a snapshot script gives the app N-1 more terminals (PARDES_TEST_VIEWS, opened as attached ones), `view <k>` types into and captures terminal k, every wait reads them all; `pardes-monkey --views=N` switches among N; `zig build replay` runs its seeds at three views too. views.snap pins two terminals: an edit seen in both, a scroll in one, a line yanked in one and put in the other, Newcol in one, Detach in one. Unit tests: own cursor, scroll, mode, layout and focus; edits shared; registers shared; terminal size by last typist; closing views; drawing the others leaves the digest; a view keeps its place in a text another edits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/snapshots')
-rw-r--r--test/snapshots/views.golden123
-rw-r--r--test/snapshots/views.snap57
2 files changed, 180 insertions, 0 deletions
diff --git a/test/snapshots/views.golden b/test/snapshots/views.golden
new file mode 100644
index 00000000..40f6a294
--- /dev/null
+++ b/test/snapshots/views.golden
@@ -0,0 +1,123 @@
+== snap one grid=80x24 cursor=7,3
+| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit
+| New Tty Find Grep Joincol Delcol
+| /tmp/pardes-snap/views/cwd/v.txt Save Tty Collapse Del
+| 1 line 1
+| 2 line 2
+| 3 line 3
+| 4 line 4
+| 5 line 5
+| 6 line 6
+| 7 line 7
+| 8 line 8
+| 9 line 9
+| 10 line 10
+| 11 line 11
+| 12 line 12
+| 13 line 13
+| 14 line 14
+| 15 line 15
+| 16 line 16
+| 17 line 17
+| 18 line 18
+| 19 line 19
+| 20 line 20
+| 21 line 21
+== snap two grid=80x24 cursor=7,3
+| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit
+| New Tty Find Grep Joincol Delcol
+| /tmp/pardes-snap/views/cwd/v.txt Save Tty Collapse Del
+| 1 line 1
+| 2 line 2
+| 3 line 3
+| 4 line 4
+| 5 line 5
+| 6 line 6
+| 7 line 7
+| 8 line 8
+| 9 line 9
+| 10 line 10
+| 11 line 11
+| 12 line 12
+| 13 line 13
+| 14 line 14
+| 15 line 15
+| 16 line 16
+| 17 line 17
+| 18 line 18
+| 19 line 19
+| 20 line 20
+| 21 line 21
+== snap one-edit grid=80x24 cursor=15,3
+|2: */tmp/pardes-snap/views/cwd/v.txt Save Tty Collapse Del
+|3: 1 EDIT-ONEline 1
+== snap two-sees grid=80x24 cursor=7,3
+|2: */tmp/pardes-snap/views/cwd/v.txt Save Tty Collapse Del
+|3: 1 EDIT-ONEline 1
+== snap two-down grid=80x24 cursor=7,6
+|3: 22 line 22
+|4: 23 line 23
+|5: 24 line 24
+|6: 25 line 25
+|7: 26 line 26
+|8: 27 line 27
+|9: 28 line 28
+|10: 29 line 29
+|11: 30 line 30
+|12: 31 line 31
+|13: 32 line 32
+|14: 33 line 33
+|15: 34 line 34
+|16: 35 line 35
+|17: 36 line 36
+|18: 37 line 37
+|19: 38 line 38
+|20: 39 line 39
+|21: 40 line 40
+|22: 41 line 41
+|23: 42 line 42
+== snap one-top grid=80x24 cursor=15,3
+== snap two-put grid=80x24 cursor=21,7
+|7: 26 EDIT-ONEline 1
+|8: 27 line 26
+|9: 28 line 27
+|10: 29 line 28
+|11: 30 line 29
+|12: 31 line 30
+|13: 32 line 31
+|14: 33 line 32
+|15: 34 line 33
+|16: 35 line 34
+|17: 36 line 35
+|18: 37 line 36
+|19: 38 line 37
+|20: 39 line 38
+|21: 40 line 39
+|22: 41 line 40
+|23: 42 line 41
+== snap two-col grid=80x24 cursor=42,1
+|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol
+|2: */tmp/pardes-snap/views/cwd/v.txt Save
+|3: Tty Collapse Del
+|4: 22 line 22
+|5: 23 line 23
+|6: 24 line 24
+|7: 25 line 25
+|8: 26 EDIT-ONEline 1
+|9: 27 line 26
+|10: 28 line 27
+|11: 29 line 28
+|12: 30 line 29
+|13: 31 line 30
+|14: 32 line 31
+|15: 33 line 32
+|16: 34 line 33
+|17: 35 line 34
+|18: 36 line 35
+|19: 37 line 36
+|20: 38 line 37
+|21: 39 line 38
+|22: 40 line 39
+|23: 41 line 40
+== snap one-col grid=80x24 cursor=21,3
+== snap one-after grid=80x24 cursor=13,4
diff --git a/test/snapshots/views.snap b/test/snapshots/views.snap
new file mode 100644
index 00000000..eba26bae
--- /dev/null
+++ b/test/snapshots/views.snap
@@ -0,0 +1,57 @@
+# Two terminals on one session, each a view of it (src/views.zig): each its
+# own layout, focus, cursor and scroll over the same panes. An edit typed in
+# one is in the other; a line yanked in one is put in the other (registers
+# are the session's); Newcol in one leaves the other's columns; Detach in
+# one lets that terminal go and leaves the other drawing.
+config Verbose off
+lines v.txt 120
+start 24 80 views=2 v.txt
+wait 8000 line 1
+stable 500 10000
+snap one
+view 2
+wait 8000 line 1
+stable 500 10000
+snap two
+# Typed in view 1: in view 2 too.
+view 1
+key i
+text EDIT-ONE
+key esc
+settle 100
+stable 400 8000
+snap one-edit
+view 2
+stable 400 8000
+snap two-sees
+# Scrolled in view 2: view 1 stays at the top.
+key pgdn
+stable 400 8000
+snap two-down
+view 1
+stable 400 8000
+snap one-top
+# Yanked in view 1, put in view 2.
+key x y
+stable 400 8000
+view 2
+key p
+stable 400 8000
+snap two-put
+# A column in view 2 only.
+key space
+text cn
+stable 400 8000
+snap two-col
+view 1
+stable 400 8000
+snap one-col
+# Detached in view 2: its terminal let go, view 1 drawing on.
+view 2
+key space
+text sD
+stable 400 8000
+view 1
+key j
+stable 400 8000
+snap one-after