summaryrefslogtreecommitdiff
path: root/src/builtins.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/builtins.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/builtins.zig')
-rw-r--r--src/builtins.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index cca7bfb5..1a2f132f 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -516,7 +516,10 @@ pub const Look = struct {
// name on the message row would only be noise over that
pub const quiet = true;
pub fn run(c: Ctx) void {
- look.lookAt(c.p, c.id, c.arg orelse return);
+ // Bare (a key bound to it, a tag's Look with nothing held): the
+ // selection, else what Enter on the cursor takes, the one expansion.
+ const arg = c.arg orelse (exec.currentOperand(c.p, c.pane) orelse return);
+ look.lookAt(c.p, c.id, arg);
}
};