diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-31 01:18:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:08 -0300 |
| commit | 8a7112f08e0ce93a37b177e3aa83637e1691b451 (patch) | |
| tree | 4a5fe4b0da18cf98cd91950a218ad4a6d324b0cc /src/builtins.zig | |
| parent | a77e342eb7fa4add700a96a661226649e8c4763f (diff) | |
| download | pardes-8a7112f08e0ce93a37b177e3aa83637e1691b451.tar.gz pardes-8a7112f08e0ce93a37b177e3aa83637e1691b451.zip | |
Look and Exec are builtins like any other
Their only special feature is now the keys they are assigned. `Look main.zig`
typed in a tag is the same look a right click is; config.look_cmd/exec_cmd
point the two buttons and Enter/Tab at them, so retargeting Enter to Grep is
one line. actOnSelection — a hand-written cascade with the builtin dispatch
nested inside it — is gone, and the `button` parameter it threaded through five
KEYBOARD call sites went with it.
New syntax, spelled once in config.zig: @`ls -la` names a command to run
rather than a file to open. Word expansion takes the quoted run whole, the way
acme does for its own </|/> words, so a click inside one does not hand Look the
fragment `ls`.
And it nests: @`Look .` unwraps, re-enters the dispatcher, and looks at the
directory. Guarded at depth 8, which is unreachable today (every re-entry
strips a word or a delimiter pair, so the string strictly shrinks) and exists
for a future syntax that does not shrink.
leader_path is now optional: a builtin may have no SPC path when its shortcut
is a key and a mouse button. New golden cmdword; the other 59 unmoved.
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 500ce264..cf144d33 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -106,6 +106,36 @@ pub fn Builtin() type { return @Enum(Tag, .exhaustive, &names, &std.simd.iota(Tag, cmds.len)); } +// ---- the two acme verbs ---- + +// Look and Execute are the verbs the whole environment is built on, and they +// are BUILTINS: `Look main.zig` typed in a tag and executed is the same look a +// right click on `main.zig` is, `Exec ls` the same as a middle click on `ls`. +// The mouse buttons and Enter/Tab are not a second path into them any more — +// they are two bindings pointing here (config.look_cmd / exec_cmd), the status +// `SPC f s` has relative to Save. That is the whole feature: what used to be a +// `button` parameter threaded through every keyboard call site, with the +// builtin dispatch nested INSIDE it, is now one word each. +// +// The operand is `arg` in both — a name's tail (`Look main.zig`), else the +// selection a chord kept, else the word the gesture pointed at, which the +// gesture resolves and passes. Nothing to act on means nothing happens, the +// way `Save` on a terminal is inert. + +pub const Look = struct { + pub fn run(c: Ctx) void { + c.p.lookAt(c.id, c.arg orelse return); + } +}; + +pub const Exec = struct { + pub fn run(c: Ctx) void { + // the destination pane is Look's business (it focuses what answered); + // an execute deliberately leaves you where you were + _ = c.p.execute(c.id, c.arg orelse return); + } +}; + // ---- session ---- pub const Kill = struct { @@ -159,8 +189,8 @@ pub const Crt = struct { }; // The image pane's three renderer toggles. They used to be words the image tag -// printed and actOnSelection matched by hand; as builtins they are executable -// anywhere, pressable under SPC and listed by `SPC ?`, which is the whole +// printed and the execute dispatcher matched by hand; as builtins they are +// executable anywhere, pressable under SPC and listed by `SPC ?`, the whole // reason the tag no longer carries them. Each acts on the pane it runs in and // is inert anywhere else, the way Save is on a terminal — flipping the field is // the whole toggle: drawImage re-matches the glyph grid when it sees |
