summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index 67ebf7cf..3281f48a 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -990,10 +990,17 @@ 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);
}
+/// Whether a script reads pane `id`'s events, and so takes its looks and
+/// execs: the 9P server's, the authority's alone (a replica has its
+/// answer, `tape.authority`).
+fn readsEvents(p: *Pardes, id: usize) bool {
+ const pane = p.panes[id] orelse return false;
+ return pane.fs.readers != 0;
+}
+
/// 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(
@@ -1006,7 +1013,7 @@ pub fn reportRange(
chord_arg: ?[]const u8,
) bool {
const scripted = p.panes[id] orelse return false;
- if (scripted.fs.readers == 0) return false;
+ if (!pardes.tape.authority(readsEvents, .{ p, id })) return false;
const is_look = cmd == config.look_cmd;
const action: ctlfs.events.Action = if (is_look)
(if (on_tag) .tag_look else .body_look)
@@ -1020,7 +1027,9 @@ pub fn reportRange(
if (is_look) {
if (!named and std.mem.indexOfAny(u8, text, "/.:") != null) flag |= ctlfs.events.flag_filename;
} else if (chord_arg != null) flag |= ctlfs.events.flag_chorded;
- if (!ctlfs.events.noteAction(p, id, action, range.q0, range.q1, flag, text)) return false;
+ // Taken whether or not this process's server has the reader: the
+ // session's said it has (a replica's has none).
+ _ = ctlfs.events.noteAction(p, id, action, range.q0, range.q1, flag, text);
// A chorded exec's argument follows as two records, its text and where
// it came from (`file:#q0,#q1`, empty when that is not known), as acme
// sends them (exec.c:182-188); the pane keeps it for the write-back.