From 08eadb3b46dc70a297ff89308dd1cd26237785d6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 24 Aug 2026 22:18:24 -0300 Subject: syntax + pdf_pane + file_pane: prose grammars paint, pdf Esc cancels, gj/gk walk wrapped rows --- test/snapshots/markup.golden | 100 +++++++++++++++++++++++++++++++++++++++++++ test/snapshots/markup.snap | 18 ++++++++ test/snapshots/wrap.golden | 64 ++++++++++++++++++++++++++- test/snapshots/wrap.snap | 23 ++++++++++ 4 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 test/snapshots/markup.golden create mode 100644 test/snapshots/markup.snap (limited to 'test') diff --git a/test/snapshots/markup.golden b/test/snapshots/markup.golden new file mode 100644 index 00000000..43d92885 --- /dev/null +++ b/test/snapshots/markup.golden @@ -0,0 +1,100 @@ +== snap typst grid=92x24 cursor=7,2 +|New Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill +| /tmp/pardes-snap/markup/cwd/paper.typ Save New Newtty Del +| 1 = Typst heading +| 2 +| 3 Prose with *bold* and _italic_ words, a `raw` span, +| 4 and #emph[call] plus #let n = 42 +| 5 +| 6 ```zig +| 7 fn widget() u8 { return 99; } +| 8 ``` +| 9 +| +| +| +| +| +| +| +| +| +| +| +| +| +== style typst +|0: 0-74 #949494,#121212, 75-91 d,#121212, +|1: 0-1 #ffffff,#626262, 2-71 #949494,#121212, 72-91 d,#121212, +|2: 0-0 d,#444444, 1-1 d,#080808, 2-6 #949494,#121212, 7-21 #cf87e8,#080808,b 22-91 d,#080808, +|3: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|4: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-17 #bdbdbd,#080808, 18-23 #ffffff,#080808,b 24-28 #bdbdbd,#080808, 29-36 #e3c78a,#080808, 37-46 #bdbdbd,#080808, 47-51 #e3c78a,#080808, 52-57 #bdbdbd,#080808, 58-91 d,#080808, +|5: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-10 #bdbdbd,#080808, 11-15 #cf87e8,#080808,b 16-27 #bdbdbd,#080808, 28-31 #cf87e8,#080808,b 32-36 #bdbdbd,#080808, 37-38 #e3c78a,#080808, 39-91 d,#080808, +|6: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|7: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-12 #e3c78a,#080808, 13-91 d,#080808, +|8: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-8 #cf87e8,#080808,b 9-23 #bdbdbd,#080808, 24-29 #cf87e8,#080808,b 30-30 #bdbdbd,#080808, 31-32 #e3c78a,#080808, 33-35 #bdbdbd,#080808, 36-91 d,#080808, +|9: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-9 #e3c78a,#080808, 10-91 d,#080808, +|10: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|11: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|12: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|13: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|14: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|15: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|16: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|17: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|18: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|19: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|20: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|21: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|22: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|23: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +== snap markdown grid=92x24 cursor=7,2 +|New Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Kill +| /tmp/pardes-snap/markup/cwd/notes.md Save New Newtty Del +| 1 # Markdown heading with *italic* +| 2 +| 3 Prose with **bold**, *italic* and an `inline` span. +| 4 +| 5 ```zig +| 6 fn gadget() u8 { return 77; } +| 7 ``` +| 8 +| +| +| +| +| +| +| +| +| +| +| +| +| +| +== style markdown +|0: 0-74 #949494,#121212, 75-91 d,#121212, +|1: 0-1 #ffffff,#626262, 2-71 #949494,#121212, 72-91 d,#121212, +|2: 0-0 d,#444444, 1-1 d,#080808, 2-6 #949494,#121212, 7-8 #bdbdbd,#080808, 9-30 #cf87e8,#080808,b 31-38 #e3c78a,#080808, 39-91 d,#080808, +|3: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|4: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-17 #bdbdbd,#080808, 18-25 #ffffff,#080808,b 26-27 #bdbdbd,#080808, 28-35 #e3c78a,#080808, 36-43 #bdbdbd,#080808, 44-51 #e3c78a,#080808, 52-57 #bdbdbd,#080808, 58-91 d,#080808, +|5: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|6: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-12 #e3c78a,#080808, 13-91 d,#080808, +|7: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-8 #cf87e8,#080808,b 9-23 #bdbdbd,#080808, 24-29 #cf87e8,#080808,b 30-30 #bdbdbd,#080808, 31-32 #e3c78a,#080808, 33-35 #bdbdbd,#080808, 36-91 d,#080808, +|8: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-9 #e3c78a,#080808, 10-91 d,#080808, +|9: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|10: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|11: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|12: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|13: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|14: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|15: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|16: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|17: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|18: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|19: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|20: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|21: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|22: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, +|23: 0-0 d,#444444, 1-1 d,#080808, 2-6 #626262,#080808, 7-91 d,#080808, diff --git a/test/snapshots/markup.snap b/test/snapshots/markup.snap new file mode 100644 index 00000000..2a28d7d7 --- /dev/null +++ b/test/snapshots/markup.snap @@ -0,0 +1,18 @@ +# markup: the two prose grammars. Typst paints headings and the `#` code sigil +# in the keyword colour, bold in the bold-attribute slot, italics and raw spans +# in their own; markdown needs a SECOND grammar (markdown_inline) to see bold +# and italics at all, and both languages inject a tagged code block's language +file paper.typ = Typst heading\n\nProse with *bold* and _italic_ words, a `raw` span,\nand #emph[call] plus #let n = 42\n\n```zig\nfn widget() u8 { return 99; }\n```\n +file notes.md # Markdown heading with *italic*\n\nProse with **bold**, *italic* and an `inline` span.\n\n```zig\nfn gadget() u8 { return 77; }\n```\n +start 24 92 paper.typ +wait 8000 Typst heading +wait 8000 widget +stable 700 20000 +snap typst +snapstyle typst +start 24 92 notes.md +wait 8000 Markdown heading +wait 8000 gadget +stable 700 20000 +snap markdown +snapstyle markdown diff --git a/test/snapshots/wrap.golden b/test/snapshots/wrap.golden index 652ffae2..47bffa5c 100644 --- a/test/snapshots/wrap.golden +++ b/test/snapshots/wrap.golden @@ -43,7 +43,67 @@ | | | -== snap off grid=48x14 cursor=18,3 +== snap visual-gj grid=48x14 cursor=10,3 +|New Newcol Joincol Find Grep Help Changelog Tuto +| /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne +| 1 0---------1---------2---------3---------↩ +| 4---------5---------6---------7---------↩ +| 8---------9---------A---------B---------↩ +| C---------D---------E---------F---------↩ +| G---------H---------I---------J--------- +| 2 second line +| 3 third line +| 4 +| +| +| +| +== snap visual-gj-again grid=48x14 cursor=10,4 +|New Newcol Joincol Find Grep Help Changelog Tuto +| /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne +| 1 0---------1---------2---------3---------↩ +| 4---------5---------6---------7---------↩ +| 8---------9---------A---------B---------↩ +| C---------D---------E---------F---------↩ +| G---------H---------I---------J--------- +| 2 second line +| 3 third line +| 4 +| +| +| +| +== snap visual-gk grid=48x14 cursor=10,3 +|New Newcol Joincol Find Grep Help Changelog Tuto +| /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne +| 1 0---------1---------2---------3---------↩ +| 4---------5---------6---------7---------↩ +| 8---------9---------A---------B---------↩ +| C---------D---------E---------F---------↩ +| G---------H---------I---------J--------- +| 2 second line +| 3 third line +| 4 +| +| +| +| +== snap visual-count-gj grid=48x14 cursor=10,5 +|New Newcol Joincol Find Grep Help Changelog Tuto +| /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne +| 1 0---------1---------2---------3---------↩ +| 4---------5---------6---------7---------↩ +| 8---------9---------A---------B---------↩ +| C---------D---------E---------F---------↩ +| G---------H---------I---------J--------- +| 2 second line +| 3 third line +| 4 +| +| +| +| +== snap off grid=48x14 cursor=10,5 |New Newcol Joincol Find Grep Help Changelog Tuto | /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne | 1 0---------1---------2---------3---------4 @@ -58,7 +118,7 @@ | | | -== snap on-again grid=48x14 cursor=18,7 +== snap on-again grid=48x14 cursor=10,5 |New Newcol Joincol Find Grep Help Changelog Tuto | /tmp/pardes-snap/wrap/cwd/long.txt Save New Ne | 1 0---------1---------2---------3---------↩ diff --git a/test/snapshots/wrap.snap b/test/snapshots/wrap.snap index b8849474..51ad6f82 100644 --- a/test/snapshots/wrap.snap +++ b/test/snapshots/wrap.snap @@ -38,6 +38,29 @@ snap clicked key j stable 400 5000 snap logical-j +# ...while `gj`/`gk` are the VISUAL pair. `gg` puts the cursor back at line 1 +# column 0 with no goal column left over, `3l` moves three in, and from there +# each `gj` steps ONE screen row: still line 1, the column kept INSIDE the row, +# so the cursor stays in grid column 10 while the row walks 2 -> 3 -> 4. `gk` +# steps back onto the row it came from. This is the only motion that reads the +# wrap map's own arithmetic, so it is the one that can silently become `j`. +key g g +stable 400 5000 +key 3 l +stable 400 5000 +key g j +stable 400 5000 +snap visual-gj +key g j +stable 400 5000 +snap visual-gj-again +key g k +stable 400 5000 +snap visual-gk +# a count is counted in ROWS too, and two of them are still inside line 1 +key 2 g j +stable 400 5000 +snap visual-count-gj # SPC t w turns it off: line 1 back on ONE row, clipped at the right edge with # no marker, lines 2 and 3 under it — the render this pane had before soft # breaks existed, because the map the readers consult goes back to empty and -- cgit v1.3