summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 17:25:24 -0300
committerGabriel Schneider <[email protected]>2026-10-01 17:30:33 -0300
commit1a33ed7221733b181726c7ad01e4ce190bcf1d05 (patch)
tree7a3990fae122ca9e5dcaf5393686814530489a6d /src/pardes.zig
parentff102e082105c78f4cc27487f550ee84d364c16c (diff)
downloadpardes-1a33ed7221733b181726c7ad01e4ce190bcf1d05.tar.gz
pardes-1a33ed7221733b181726c7ad01e4ce190bcf1d05.zip
One Look path: Enter, Tab and a bare Look take what a click at the cursor takes, a diff line's address included, and an event reader is told of them as of a click
The keyboard expanded the cursor's word on its own (look.expandedSel), so a diff line's address (and a hunk line's code word, without its +/-) was the mouse's alone: Enter on `+line` looked for the text in the diff. Now exec.operandAt is the one expansion: pointerOperand is it with a gesture's selection borrowed, the Enter/Tab path and a bare Look (exec.currentOperand) are it from the cursor, and both dispatch through mouse.dispatchPointerBuiltin, so a pane with an event reader hears a key's look or exec as a click's. A test runs one diff line and one file:12:5: line through a B3 click, a B3 sweep, Enter, a bare Look, the look file and an event write-back, and asserts each lands in the same file, line and column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index d0bb9229..1cc1c5b8 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -6326,9 +6326,11 @@ pub const Pardes = struct {
return;
}
}
- const sel = look.expandedSel(p, pane, look.cursorWordSel(p, pane)) orelse return;
- const word = edit.selectionText(p, pane, sel) catch return;
- exec.runBuiltinFrom(p, cmd, p.active, "", word, true);
+ // 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);
+ mouse.dispatchPointerBuiltin(p, p.active, cmd, operand.text, .{ .on_tag = false, .operand = operand });
return;
}
if (t.mode == .normal and t.what == .body and pane.hasPdf()) return normal.handlePdfNormal(p, pane, key);