summaryrefslogtreecommitdiff
path: root/src/pardes.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/pardes.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/pardes.zig')
-rw-r--r--src/pardes.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 674128a1..425a0993 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -6296,12 +6296,13 @@ pub const Pardes = struct {
const range = t.primaryRange(shown, 0);
const lo = @min(range.anchor, range.head);
const hi = @max(range.anchor, range.head);
- const txt = if ((t.vsel.active and t.vsel.explicit) or t.msel.active)
- shown[lo..hi]
+ const span: [2]usize = if ((t.vsel.active and t.vsel.explicit) or t.msel.active)
+ .{ lo, hi }
else word: {
const b = config.wordBounds(shown, modal.selectionCursor(shown, range));
- break :word shown[b.lo..b.hi];
+ break :word .{ b.lo, b.hi };
};
+ const txt = shown[span[0]..span[1]];
// A column tag's command acts on that column, empty or not.
p.exec_column = if (header != null) p.header_column else null;
defer p.exec_column = null;
@@ -6310,7 +6311,12 @@ pub const Pardes = struct {
// Out of the tag or header FIRST: Del frees the pane, Kill
// and Restore the whole session.
if (header != null) tagline.exitHeader(p) else pane.focus = .body;
- if (txt.len > 0) exec.runBuiltin(p, cmd, p.active, "", txt);
+ if (txt.len == 0) return;
+ // A pane's tag word: an event reader hears it as a click on
+ // it, at its place in the tag (flatSurface is the tag's text).
+ if (header == null and t.what == .tag and
+ mouse.reportRange(p, p.active, cmd, txt, true, .{ .q0 = @intCast(span[0]), .q1 = @intCast(span[1]) }, null)) return;
+ exec.runBuiltin(p, cmd, p.active, "", txt);
return;
}
edit.pinPaneCursor(p, &pane.body);
@@ -6330,7 +6336,7 @@ pub const Pardes = struct {
// The cursor's word as a click there takes it: one expansion
// (exec.operandAt), a diff line's address and all, and an
// event reader told as a click tells it.
- const operand = exec.operandAt(p, pane, look.cursorWordSel(p, pane), false);
+ const operand = exec.operandAt(p, pane, look.cursorWordSel(p, pane), false, cmd == config.look_cmd);
mouse.dispatchPointerBuiltin(p, p.active, cmd, operand.text, .{ .on_tag = false, .operand = operand });
return;
}