diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 07:42:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | ed185f305731309cbddb981166678a552f2fda84 (patch) | |
| tree | 1eb984c60c25ba131d0a8a99e5fbbc2131fcc4aa /src/vector/shaders | |
| parent | c009f708e631700fb1d65ccba2c8229c10054528 (diff) | |
| download | sketchbook-ed185f305731309cbddb981166678a552f2fda84.tar.gz sketchbook-ed185f305731309cbddb981166678a552f2fda84.zip | |
examples/live: pardes's editor in State, typed with helix's keys
The plain buffer of part 1 gives way to pardes's text pane as a library
(`pardes-editor`, src/lib_editor.zig there): `Editor(.{ .text = 4096,
.undo = 16 KiB, .registers = 1024, .selections = 64 })`, a value of plain
data, 39,264 bytes of a State of 43,480. The package takes pardes by path
(`../../../02-pardes-code`, the checkout beside sketchbook's) with
`.editor = true` and its smallest tree-sitter set; sketchbook is spelled
`../../../sketchbook` as pardes spells it, since a package is told by its
path's spelling and sketchbook's build.zig cannot be two modules.
`update` turns events into keys: printables from `text` events only,
specials (Escape, Return, Backspace, Tab, arrows, Home, End, pages,
Delete) and ctrl or alt chords (helix's `A-I` an upper-case letter) from
`key_down`, a chord's letter dropped if it also comes as text. Each call
into the editor thaws the value into a static 128 KiB buffer reset for
the call (`update` may not allocate from the host; a key at 4 KiB of text
took 29 KiB of it). The text is compiled when the editor's `revision`
moves.
Measured (a scratch bench through `update`, the survey's program, 646
bytes, a key typed into its middle, 400 times): a typed key, edit and
compile, 59.5 us best and 78.8 mean in Debug, 7.4 and 7.8 in
ReleaseFast; a motion 6.4 and 0.3. The package's cold `zig build lib`
went from 3.1 s to 6.6 s, its first build under `--watch -fincremental`
from 4.0 to 5.9 s, and an edit of main.zig rebuilt under it from
0.062-0.067 s to 0.067-0.092 s.
Test: test/live.script types through helix now (`i`, the text, Escape,
`gl`, `h`, `rx` for the edit, `l` `d` to break the line, `u` to mend it)
and still replays to equal text, tapes and screenshots, its seeks moved
to the marks' new times. zig build test: 81 of 81 steps, 6 of 6 tests.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/vector/shaders')
0 files changed, 0 insertions, 0 deletions
