From 9dba9742f4f2071fd85c67c3a7fe311b7f37617c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 17:50:26 -0300 Subject: Enter and Tab on a tag word tell an event reader as a click on it does, at its place in the tag; only a look takes a diff line's address, an exec there takes the word (follows vpmzwuzk) Co-Authored-By: Claude Opus 5.5 --- src/mouse.zig | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/mouse.zig') diff --git a/src/mouse.zig b/src/mouse.zig index 7a2d0805..8020fda8 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -964,6 +964,21 @@ fn reportGesture( on_tag: bool, operand: exec.PointerOperand, chord_arg: ?[]const u8, +) bool { + if ((p.panes[id] orelse return false).fs.readers == 0) return false; + return reportRange(p, id, cmd, text, on_tag, gestureRange(p, id, text, on_tag, operand), chord_arg); +} + +/// An event reader told of a look or an exec of `text` at `range` of the +/// tag or body, by a click or a key alike: false when the pane has none. +pub fn reportRange( + p: *Pardes, + id: usize, + cmd: Builtin, + text: []const u8, + on_tag: bool, + range: ctlfs.pane.State.Range, + chord_arg: ?[]const u8, ) bool { const scripted = p.panes[id] orelse return false; if (scripted.fs.readers == 0) return false; @@ -973,7 +988,6 @@ fn reportGesture( else (if (on_tag) .tag_exec else .body_exec); const named = exec.namesBuiltin(text); - const range = gestureRange(p, id, text, on_tag, operand); // No flag 2: the record already carries the word a click took, its // range and text, and in acme flag 2 promises a second record with them // (editors/acme/exec.c:154-183, look.c:42-68), which none follows here. @@ -1293,7 +1307,7 @@ fn dragRelease(p: *Pardes, button: Mouse.Button) void { return; } }; - var operand = exec.pointerOperand(p, pane, clk); + var operand = exec.operandAt(p, pane, clk, true, s.button == config.look_button); if (operand.expanded) |expanded| pane.sel[b] = expanded else if (operand.text == null) -- cgit v1.3