From 9dba9742f4f2071fd85c67c3a7fe311b7f37617c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 17:50:26 -0300 Subject: 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 --- src/exec.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index 30a1a894..9d1b81d5 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -108,14 +108,14 @@ pub const PointerOperand = struct { }; pub fn pointerOperand(p: *Pardes, pane: *Pane, clicked: Pane.Sel) PointerOperand { - return operandAt(p, pane, clicked, true); + return operandAt(p, pane, clicked, true, true); } /// The body's explicit selection, else what a look at its cursor takes. pub fn currentOperand(p: *Pardes, pane: *Pane) ?[]const u8 { if (pane.file == null and !pane.isTerminal()) return null; if ((pane.body.vsel.active and pane.body.vsel.explicit) or pane.body.msel.active) return edit.currentSelText(p, pane); - return operandAt(p, pane, look.cursorWordSel(p, pane), false).text; + return operandAt(p, pane, look.cursorWordSel(p, pane), false, true).text; } /// What a look or an exec at `clicked` takes: the ONE expansion every @@ -123,8 +123,10 @@ pub fn currentOperand(p: *Pardes, pane: *Pane) ?[]const u8 { /// Look), so a diff line, a hunk line's code word and a file word expand /// alike however they are reached (look.zig's "every entry point" test). /// `borrow`: a gesture inside a kept or modal selection takes it; the -/// keyboard has said which selection it means already. -pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool) PointerOperand { +/// keyboard has said which selection it means already. `for_look`: only a +/// look takes a diff line's address; an exec there takes the word, as +/// anywhere else. +pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_look: bool) PointerOperand { const visible = clicked.r0 - @as(i32, pane.tag_rows); const wrapped = pane.wrapAt(visible); const raw = pane.isTerminal() and pane.body.mode == .tty and clicked.r0 >= pane.tag_rows; @@ -193,7 +195,7 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool) Point // look from there. A hunk line's code is words, looked at as ever: // the code's, the prefix never one of them. var word_from: usize = 0; - if (clicked.r0 >= pane.tag_rows and clicked.r0 == clicked.r1 and clicked.c0 == clicked.c1 and row >= 0) diff: { + if (for_look and clicked.r0 >= pane.tag_rows and clicked.r0 == clicked.r1 and clicked.c0 == clicked.c1 and row >= 0) diff: { var address_buf: [4096 + 32]u8 = undefined; const at: usize = @intCast(row); const click = look.diffClick(p, pane, at, @intCast(@max(0, col)), &address_buf) orelse break :diff; -- cgit v1.3