diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/panes.zig | 10 | ||||
| -rw-r--r-- | test/snapshot.zig | 5 | ||||
| -rw-r--r-- | test/snapshots/chordcut.snap | 15 | ||||
| -rw-r--r-- | test/snapshots/diffview.golden | 148 | ||||
| -rw-r--r-- | test/snapshots/diffview.snap | 37 |
5 files changed, 204 insertions, 11 deletions
diff --git a/test/panes.zig b/test/panes.zig index d7fa3514..6f321abf 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -981,10 +981,12 @@ const TtySelectionTests = struct { const target = p.rects[1]; const tx = target.x + config.GUTTER + 2; const ty = bodyY(p, target); - p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = tx, .row = ty } }); - p.update(.{ .mouse = .{ .button = .right, .kind = .press, .col = tx, .row = ty } }); - p.update(.{ .mouse = .{ .button = .right, .kind = .release, .col = tx, .row = ty } }); - p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = tx, .row = ty } }); + // Shift: over a program that tracks the mouse the chord is + // pardes's only so, and elsewhere Shift changes nothing. + p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = tx, .row = ty, .shift = true } }); + p.update(.{ .mouse = .{ .button = .right, .kind = .press, .col = tx, .row = ty, .shift = true } }); + p.update(.{ .mouse = .{ .button = .right, .kind = .release, .col = tx, .row = ty, .shift = true } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = tx, .row = ty, .shift = true } }); var written: std.Io.Writer.Allocating = .init(p.gpa); defer written.deinit(); while (p.nextEffect()) |effect| { diff --git a/test/snapshot.zig b/test/snapshot.zig index a176da7a..5522fbb9 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -1489,6 +1489,11 @@ fn buttonCode(name: []const u8) ?u16 { const base = buttonCode(name["ctrl-".len..]) orelse return null; return base + 16; } + // Shift: over a program that tracks the mouse, pardes's own gesture. + if (std.mem.startsWith(u8, name, "shift-")) { + const base = buttonCode(name["shift-".len..]) orelse return null; + return base + 4; + } if (std.mem.eql(u8, name, "left")) return 0; if (std.mem.eql(u8, name, "middle")) return 1; if (std.mem.eql(u8, name, "right")) return 2; diff --git a/test/snapshots/chordcut.snap b/test/snapshots/chordcut.snap index 1baef7ec..fddd9e92 100644 --- a/test/snapshots/chordcut.snap +++ b/test/snapshots/chordcut.snap @@ -124,9 +124,10 @@ snapstyle clickdismiss press middle 59 23 release middle 59 23 stable 700 15000 -# tty paste chord: a mouse-listening app gets the click forwarded (SGR, -# body-relative) then the register between bracketed-paste markers — -# cat -v prints the received bytes visibly +# tty paste chord: over a mouse-listening app the chord is pardes's with +# Shift held; the app gets a click where the text goes (SGR, body-relative) +# then the register between bracketed-paste markers — cat -v prints the +# received bytes visibly press left 35 23 release left 35 23 stable 400 5000 @@ -135,10 +136,10 @@ stable 600 8000 text stty -icanon -echo; printf '\x1b[?2004h\x1b[?1000h\x1b[?1006h'; cat -v key enter stable 700 8000 -press left 40 25 -press right 40 25 -release right 40 25 -release left 40 25 +press shift-left 40 25 +press shift-right 40 25 +release shift-right 40 25 +release shift-left 40 25 stable 700 8000 snap ttyprobe # a plain prompt (mouse modes off) gets no click bytes — just the paste; diff --git a/test/snapshots/diffview.golden b/test/snapshots/diffview.golden new file mode 100644 index 00000000..9e171fd8 --- /dev/null +++ b/test/snapshots/diffview.golden @@ -0,0 +1,148 @@ +== snap diff-pane grid=100x31 cursor=7,3 +|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/diffview/cwd/change.diff Save Tty Collapse Del +| 1 diff --git a/src/shape.zig b/src/shape.zig +| 2 index 1111111..2222222 100644 +| 3 --- a/src/shape.zig +| 4 +++ b/src/shape.zig +| 5 @@ -1,10 +1,12 @@ +| 6 const std = @import("std"); +| 7 +| 8 pub const Shape = union(enum) { +| 9 circle: f32, +| 10 - square: u8 = 7, +| 11 + square: f32, +| 12 + triangle: struct { base: f32, height: f32 }, +| 13 +| 14 const note = +| 15 - \\areas +| 16 + \\areas, defer +| 17 + \\summed +| 18 ; +| 19 }; +| 20 +== style diff-colours grid=100x31 +|0: 0-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-44 #dfbce5,#314738, 45-99 #becfc4,#314738, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-99 #b9f480,#0d1410, +|4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #b9f480,#0d1410, +|5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #b9f480,#0d1410, +|6: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #b9f480,#0d1410, +|7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #c9a7ed,#0d1410, +|8: 0-0 d,#608269, 1-4 d,#0d1410, 5-7 #59675c,#0d1410, 8-19 #e5eee5,#0d1410, 20-26 #c9a7ed,#0d1410, 27-27 #e5eee5,#0d1410, 28-32 #b8d88a,#0d1410, 33-99 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, +|10: 0-0 d,#608269, 1-4 d,#0d1410, 5-7 #59675c,#0d1410, 8-25 #e5eee5,#0d1410, 26-30 #c9a7ed,#0d1410, 31-31 #e5eee5,#0d1410, 32-35 #c9a7ed,#0d1410, 36-99 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-4 d,#0d1410, 5-11 #59675c,#0d1410, 12-99 #e5eee5,#0d1410, +|12: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #f1a39b,#302b25,b 8-11 #f1a39b,#302b25, 12-24 #e5eee5,#302b25, 25-25 #f8c082,#302b25, 26-99 #e5eee5,#302b25, +|13: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #b6ce94,#263025,b 8-11 #b6ce94,#263025, 12-99 #e5eee5,#263025, +|14: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #b6ce94,#263025,b 8-11 #b6ce94,#263025, 12-21 #e5eee5,#263025, 22-28 #c9a7ed,#263025, 29-99 #e5eee5,#263025, +|15: 0-0 d,#608269, 1-3 d,#0d1410, 4-99 #59675c,#0d1410, +|16: 0-0 d,#608269, 1-3 d,#0d1410, 4-11 #59675c,#0d1410, 12-99 #e5eee5,#0d1410, +|17: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #f1a39b,#302b25,b 8-15 #f1a39b,#302b25, 16-99 #b8d88a,#302b25, +|18: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #b6ce94,#263025,b 8-15 #b6ce94,#263025, 16-99 #b8d88a,#263025, +|19: 0-0 d,#608269, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-7 #b6ce94,#263025,b 8-15 #b6ce94,#263025, 16-99 #b8d88a,#263025, +|20: 0-0 d,#608269, 1-3 d,#0d1410, 4-11 #59675c,#0d1410, 12-99 #e5eee5,#0d1410, +|21: 0-0 d,#608269, 1-3 d,#0d1410, 4-7 #59675c,#0d1410, 8-99 #e5eee5,#0d1410, +|22: 0-0 d,#608269, 1-3 d,#0d1410, 4-99 #59675c,#0d1410, +|23: 0-0 d,#608269, 1-99 d,#0d1410, +|24: 0-0 d,#608269, 1-99 d,#0d1410, +|25: 0-0 d,#608269, 1-99 d,#0d1410, +|26: 0-0 d,#608269, 1-99 d,#0d1410, +|27: 0-0 d,#608269, 1-99 d,#0d1410, +|28: 0-0 d,#608269, 1-99 d,#0d1410, +|29: 0-0 d,#608269, 1-99 d,#0d1410, +|30: 0-0 d,#608269, 1-99 d,#0d1410, +== snap look-added-line grid=100x31 cursor=55,22 +|16: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext +|17: 1 const std = @import("std"); +|18: 2 +|19: 3 pub const Shape = union(enum) { +|20: 4 circle: f32, +|21: 5 square: f32, +|22: 6 triangle: struct { base: f32, height: f32 }, +|23: 7 +|24: 8 const note = +|25: 9 \\areas, defer +|26: 10 \\summed +|27: 11 ; +|28: 12 }; +|29: 13 +== snap command-pane grid=100x31 cursor=7,3 +|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/diffview/cwd/cmds.txt Save Tty Collapse Del +| 1 cat change.diff Exec +| 2 +| +| +| +| +| +| +| +| +| +| +| +| +| /tmp/pardes-snap/diffview/cwd (cat change.diff) exit 0 Kill Save Collapse Del +| circle: f32, +| - square: u8 = 7, +| + square: f32, +| + triangle: struct { base: f32, height: f32 }, +| +| const note = +| - \\areas +| + \\areas, defer +| + \\summed +| ; +| }; +| exit 0 +== style command-colours grid=100x31 +|0: 0-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-41 #dfbce5,#314738, 42-99 #becfc4,#314738, +|3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-93 #e5eee5,#0d1410, 94-94 #e5eee5,#1d2824, 95-99 #b2c3b8,#1d2824, +|4: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, +|5: 0-0 d,#608269, 1-99 d,#0d1410, +|6: 0-0 d,#608269, 1-99 d,#0d1410, +|7: 0-0 d,#608269, 1-99 d,#0d1410, +|8: 0-0 d,#608269, 1-99 d,#0d1410, +|9: 0-0 d,#608269, 1-99 d,#0d1410, +|10: 0-0 d,#608269, 1-99 d,#0d1410, +|11: 0-0 d,#608269, 1-99 d,#0d1410, +|12: 0-0 d,#608269, 1-99 d,#0d1410, +|13: 0-0 d,#608269, 1-99 d,#0d1410, +|14: 0-0 d,#608269, 1-99 d,#0d1410, +|15: 0-0 d,#608269, 1-99 d,#0d1410, +|16: 0-0 d,#608269, 1-99 d,#0d1410, +|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-99 #b2c3b8,#1d2824, +|18: 0-0 d,#152019, 1-6 d,#0d1410, 7-99 #e5eee5,#0d1410, +|19: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #f1a39b,#302b25,b 3-6 #f1a39b,#302b25, 7-19 #e5eee5,#302b25, 20-20 #f8c082,#302b25, 21-99 #e5eee5,#302b25, +|20: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #b6ce94,#263025,b 3-6 #b6ce94,#263025, 7-99 #e5eee5,#263025, +|21: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #b6ce94,#263025,b 3-6 #b6ce94,#263025, 7-16 #e5eee5,#263025, 17-23 #c9a7ed,#263025, 24-99 #e5eee5,#263025, +|22: 0-0 d,#152019, 1-99 d,#0d1410, +|23: 0-0 d,#608269, 1-6 d,#0d1410, 7-99 #e5eee5,#0d1410, +|24: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#302b25,b 3-10 #f1a39b,#302b25, 11-99 #b8d88a,#302b25, +|25: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#263025,b 3-10 #b6ce94,#263025, 11-99 #b8d88a,#263025, +|26: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#263025,b 3-10 #b6ce94,#263025, 11-99 #b8d88a,#263025, +|27: 0-0 d,#608269, 1-6 d,#0d1410, 7-99 #e5eee5,#0d1410, +|28: 0-0 d,#608269, 1-2 d,#0d1410, 3-99 #e5eee5,#0d1410, +|29: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, +|30: 0-0 d,#152019, 1-99 d,#0d1410, +== snap command-look grid=100x31 cursor=23,10 +|3: 1 cat change.diff +|5: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext +|6: 1 const std = @import("std"); +|7: 2 +|8: 3 pub const Shape = union(enum) { +|9: 4 circle: f32, +|10: 5 square: f32, +|11: 6 triangle: struct { base: f32, height: f32 }, +|12: 7 +|13: 8 const note = +|14: 9 \\areas, defer +|15: 10 \\summed +|16: 11 ; diff --git a/test/snapshots/diffview.snap b/test/snapshots/diffview.snap new file mode 100644 index 00000000..23d060b7 --- /dev/null +++ b/test/snapshots/diffview.snap @@ -0,0 +1,37 @@ +# A diff pane, for reviewing a change: each hunk's code coloured as Zig (a +# multi-line string over three lines, `defer` inside it no keyword), added and +# removed rows tinted to the pane's edge with their prefix in the tint's hue, +# headers muted. Then a right click on an added line's `+` opens the new file +# at that line: the path is the repository's (a `.git` above the diff), b/ +# dropped. +dirmk .git +dirmk src +file src/shape.zig const std = @import("std");\n\npub const Shape = union(enum) {\n circle: f32,\n square: f32,\n triangle: struct { base: f32, height: f32 },\n\n const note =\n \\\\areas, defer\n \\\\summed\n ;\n};\n +file change.diff diff --git a/src/shape.zig b/src/shape.zig\nindex 1111111..2222222 100644\n--- a/src/shape.zig\n+++ b/src/shape.zig\n@@ -1,10 +1,12 @@\n const std = @import("std");\n \n pub const Shape = union(enum) {\n circle: f32,\n- square: u8 = 7,\n+ square: f32,\n+ triangle: struct { base: f32, height: f32 },\n \n const note =\n- \\\\areas\n+ \\\\areas, defer\n+ \\\\summed\n ;\n };\n +start 31 100 change.diff +wait 8000 Newcol Joincol +stable 700 20000 +snap diff-pane +snapstyle diff-colours +press right 8 15 +release right 8 15 +stable 700 15000 +snap look-added-line +# The same diff printed by a command (`git diff`, here `cat`) into a command +# pane: its output is told for a diff and coloured the same, over the colours +# the program printed, and a right click on a `+` there opens the file too. +file cmds.txt cat change.diff\n +start 31 100 cmds.txt +wait 8000 cmds.txt +stable 700 20000 +press middle 7 4 +drag middle 22 4 +release middle 22 4 +wait 10000 exit 0 +stable 700 15000 +snap command-pane +snapstyle command-colours +press right 3 21 +release right 3 21 +stable 700 15000 +snap command-look |
