diff options
Diffstat (limited to 'src/ninep/events.zig')
| -rw-r--r-- | src/ninep/events.zig | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig index a12cf86d..d75c399b 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -508,6 +508,16 @@ pub fn noteAction( return true; } +/// A record that follows another with no place of its own, `<c>0 0 0 <n> +/// <text>`: a chorded exec's argument and its location (acme exec.c:182). +pub fn noteFollow(p: *Pardes, id: usize, action: Action, text: []const u8) void { + const pane = p.panes[id] orelse return; + if (pane.fs.readers == 0) return; + var buf: [max_record_text + 64]u8 = undefined; + pane.fs.events.push(p.gpa, formatRecord(&buf, p.fs.origin, action, 0, 0, 0, text)); + p.fs.news = true; +} + pub fn notePtyOutput(p: *Pardes, id: usize, bytes: []const u8) void { if (id >= MAX_PANES or bytes.len == 0) return; const pf = &(p.panes[id] orelse return).fs; @@ -599,7 +609,18 @@ pub fn writeEvent(p: *Pardes, req: Req, id: usize) Reply { // been (acme's xfideventwrite, xfid.c:842-844): a REPL bound for // it takes it. One that came from a write to exec (`F`) was // never a click, and runs as the command it was. - .body_exec => _ = exec.executeFrom(p, live, text, r.origin != 'F'), + // The chorded exec a reader was told of runs with its argument + // (mouse.reportGesture), when it is that range written back. + .body_exec => { + const pf = &pane.fs; + const arg = if (pf.chord_arg) |a| (if (pf.chord_at.q0 == r.q0 and pf.chord_at.q1 == r.q1) a else null) else null; + _ = exec.executeFrom(p, live, exec.withArg(p, text, arg), r.origin != 'F'); + if (arg != null) if (p.paneBySerial(serial)) |still| { + const spf = &p.panes[still].?.fs; + if (spf.chord_arg) |a| p.gpa.free(a); + spf.chord_arg = null; + }; + }, .tag_exec => _ = exec.execute(p, live, text), .body_look, .tag_look => look.lookAt(p, live, text), else => unreachable, |
