diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 13:20:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 13:34:00 -0300 |
| commit | 3d3929960bdc51aa491bdbb5cf83d1b9ab8bb197 (patch) | |
| tree | 7bc5f43e1f12e78f2510a8b867cefae3455d2e7f /test | |
| parent | 59f3f59cc8bdd7c012050cd2e1d4cbb41b473642 (diff) | |
| download | pardes-3d3929960bdc51aa491bdbb5cf83d1b9ab8bb197.tar.gz pardes-3d3929960bdc51aa491bdbb5cf83d1b9ab8bb197.zip | |
The terminal casts pin the orchard theme and show all four syntax colours, and the petscii cast opens its pictures on camera from a README
pardes colours four syntax classes (keyword, string, number, comment),
so main.c gains a comment to show the fourth; types and function names
stay plain in any theme. The petscii cast starts on a README naming the
pictures and the manual, right-clicks each open, no longer runs
Petscii, and searches 'bit 21', which first appears on the CPUID page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/record_casts.py | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/test/record_casts.py b/test/record_casts.py index d0daff11..13893517 100644 --- a/test/record_casts.py +++ b/test/record_casts.py @@ -512,7 +512,7 @@ static int square(int n) int main(void) { - int sum = 0; + int sum = 0; /* 1 + 4 + 9 + 16 */ for (int i = 1; i <= 4; i++) sum += square(i); printf("squares: %d\\n", sum); @@ -609,14 +609,23 @@ def mandelbrot(path, cx, cy, width, iterations, period, size=(480, 320)): im.save(path) +ART_README = '''pictures, right-click a name: + + mandelbrot.png the whole set + seahorse.png a seahorse valley, zoomed in + sdm.pdf Intel SDM vol. 2, 2,515 pages +''' + + def make_art(pdf): - """The classic view, a seahorse valley's spiral, and a short name for - the manual (a symlink: the PDF is only read).""" + """The classic view, a seahorse valley's spiral, a short name for the + manual (a symlink: the PDF is only read), and a README naming them.""" shutil.rmtree(ART, ignore_errors=True) ART.mkdir(parents=True) mandelbrot(ART / 'mandelbrot.png', -0.65, 0.0, 3.2, 96, 10.5) mandelbrot(ART / 'seahorse.png', -0.7436, 0.1318, 0.0035, 400, 6.0) (ART / 'sdm.pdf').symlink_to(pdf) + (ART / 'README').write_text(ART_README) # --------------------------------------------------------------------------- @@ -788,23 +797,23 @@ def terminals(r): def petscii(r): - """Mandelbrot views as PETSCII glyph art; the Intel manual's sections, - a jump to CPUID and a search.""" + """Right-click opens the Mandelbrot views, drawn as PETSCII glyph art; + then the Intel manual: its sections, a jump to CPUID and a search.""" + def look(name, until, hold): + c, w = r.find(name) + r.sweep(2, (c, w), (c + len(name), w), show=.5, hold=hold, until=until, quiet=.4, what=name) + def close(name, hold): c, w = r.find('art/' + name, after=2) start, end = word_at(r, 'Del', w) r.sweep(1, start, end, show=.4, hold=hold, until=lambda s: 'art/' + name not in s.text(), what='Del ' + name) - r.step(None, until=lambda s: 'mandelbrot.png' in s.text(), quiet=.6, hold=2.2) - keys(r, ' tp', 1.5) # Petscii: the tag reads petscii:on - type_in_tag(r, 1, ' seahorse.png') # the column's tag; B3 there opens it in the column - start, end = word_at(r, 'seahorse.png', 1) - r.sweep(2, start, end, show=.5, hold=1.0, until=lambda s: 'art/seahorse.png' in s.text(), what='the seahorse') - close('mandelbrot.png', 2.2) - type_in_tag(r, 1, ' sdm.pdf') - start, end = word_at(r, 'sdm.pdf', 1) - r.sweep(2, start, end, show=.5, hold=1.0, until=lambda s: '[1/2515]' in s.text(), what='the PDF') - close('seahorse.png', 1.2) + r.step(None, until=lambda s: 'sdm.pdf' in s.text(), quiet=.4, hold=1.6) + look('mandelbrot.png', lambda s: 'art/mandelbrot.png' in s.text(), 2.0) + close('mandelbrot.png', .5) + look('seahorse.png', lambda s: 'art/seahorse.png' in s.text(), 2.0) + close('seahorse.png', .5) + look('sdm.pdf', lambda s: '[1/2515]' in s.text(), 1.5) c, w = r.find('PdfSections') r.sweep(1, (c, w), (c + len('PdfSections'), w), show=.5, hold=1.3, until=lambda s: 'Chapter 1' in s.text(), what='the sections') @@ -818,9 +827,10 @@ def petscii(r): until=lambda s: '[317/2515]' in s.text(), what='the jump') start, end = word_at(r, 'Del', w) r.sweep(1, start, end, show=.4, hold=.8, until=lambda s: '+PdfSections' not in s.text(), what='Del sections') - r.click(0, 40, 8, hold=.3) + c, w = r.find('CPUID—CPU Identification') + r.click(0, c, w + 3, hold=.3) r.step('/', hold=.3) - r.type('Vendor', until=lambda s: '/Vendor' in s.text(), last_hold=.3) + r.type('bit 21', until=lambda s: '/bit 21' in s.text(), last_hold=.3) r.step('\r', hold=2.0, until=lambda s: '+Search' in s.text(), quiet=.4, timeout=60, what='the search') @@ -834,9 +844,9 @@ CASTS = { title='Terminals as panes', caption='A shell beside a file: Ctrl-b, copy a line, page git log.'), 'petscii': dict( - run=petscii, cwd=ART, args=['mandelbrot.png'], + run=petscii, cwd=ART, args=['README'], title='Images and PDFs in a plain terminal', - caption='No kitty graphics: Mandelbrots as PETSCII, then the Intel manual searched.'), + caption='No kitty graphics: a Mandelbrot in PETSCII, then the Intel manual searched.'), } @@ -848,7 +858,7 @@ def make_home(work): # No animation or blink: a frame drawn on a timer would land in the cast # wherever the wall clock put it. (home / 'config/pardes/init').write_text( - 'Shell /bin/sh\nMessageLinger 0\nMessageAnimation off\nCursorBlink off\n' + 'Theme orchard\nShell /bin/sh\nMessageLinger 0\nMessageAnimation off\nCursorBlink off\n' 'SelectionGlow off\nHoverGlow off\nJumpTrail off\nThumbFlash off\n') (home / '.gitconfig').write_text('[log]\n\tabbrevCommit = true\n[color]\n\tui = always\n') return home |
