summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 17:50:26 -0300
committerGabriel Schneider <[email protected]>2026-10-01 18:08:12 -0300
commit9dba9742f4f2071fd85c67c3a7fe311b7f37617c (patch)
tree0aaf9aa94dc6f185568db4b9b4ad500b9ae66943 /src/mouse.zig
parent8c74f9a8f199ea0c2d20cc524358d224ea192005 (diff)
downloadpardes-9dba9742f4f2071fd85c67c3a7fe311b7f37617c.tar.gz
pardes-9dba9742f4f2071fd85c67c3a7fe311b7f37617c.zip
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 <[email protected]>
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index 7a2d0805..8020fda8 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -965,6 +965,21 @@ fn reportGesture(
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;
const is_look = cmd == config.look_cmd;
@@ -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)