diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 07:23:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | a63185292e80beac3848f4f6395c61d941f5144f (patch) | |
| tree | e097eb6675db1af9a098e647a5b9f33c161c7ba4 /src/look.zig | |
| parent | 97780909cbe0f4c62dfb9b012bff3fe7e7ec32f9 (diff) | |
| download | pardes-a63185292e80beac3848f4f6395c61d941f5144f.tar.gz pardes-a63185292e80beac3848f4f6395c61d941f5144f.zip | |
A look that goes to another pane leaves the looking pane's dot alone
Every look that found something cleared the looker's selection first, so
`@p5:2` or `f.txt:2` written to a pane's look collapsed its dot to
q1-1. Only a look that stays in the pane starts from a clean selection
now; one that goes elsewhere takes away just the click's highlight, and a
miss changes nothing, as acme's look does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/look.zig b/src/look.zig index 92e711fa..2f712fae 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1381,9 +1381,16 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void { // already clamped, so the one written is asked). if (found == .pane and found.pane.id < MAX_PANES) if (p.panes[found.pane.id]) |shown| if (shown.file) |*f| if (pl.at.line > panes.File.nlines(p.gpa, f)) return missedLine(p, id, trimmed, pl.at.line); - // A miss changes nothing, the selection included; anything else starts - // from a clean one. - if (found != .none) clearNavigationSelection(p, pane); + // A miss changes nothing, the selection included; a look that stays in + // this pane starts from a clean one. One that goes to another pane + // leaves this one's dot alone, as acme's does: only the click's own + // highlight goes. + if (found == .pane and found.pane.id == id) + clearNavigationSelection(p, pane) + else if (found != .none) { + for (0..pane.sel.len) |slot| pane.clearPointerSelection(slot); + pane.sel = @splat(.{}); + } switch (found) { .none => { // A raw terminal's clicks are its program's; a look written over @@ -1717,6 +1724,6 @@ test "Look ignores missing and out of bounds pane addresses" { lookAt(p, 0, operand); try std.testing.expectEqual(@as(usize, 0), p.active); try std.testing.expectEqual(@as(i32, 0), pane.body.cur_row); - try std.testing.expect(!pane.body.vsel.active); + try std.testing.expect(pane.body.vsel.active); // a miss changes nothing, the selection included } } |
