summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:04:16 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitaa1d8a848585dcc1b3f1775e0b98435824f28e7d (patch)
tree3a1a6061b927601dcb7220f7d368b0eb37c8b02d /src/look.zig
parent0ec8d0dc6217486446f2fe2156dff136173a4ef5 (diff)
downloadpardes-aa1d8a848585dcc1b3f1775e0b98435824f28e7d.tar.gz
pardes-aa1d8a848585dcc1b3f1775e0b98435824f28e7d.zip
`@p<terminal>:N` past the terminal's last line is a miss, as in a file
The line-past-end check read only a file pane's lines, so a terminal's look went nowhere and said nothing. A terminal's lines are its logical lines, as a +Search of it lists them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/look.zig b/src/look.zig
index 4ee5a638..87dcede3 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -1379,8 +1379,14 @@ pub fn lookAt(p: *Pardes, id: usize, operand: []const u8) void {
const found = resolveLookTarget(p, id, txt, &realbuf);
// A line past the end of an open pane is a miss (the target's line is
// 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);
+ if (found == .pane and found.pane.id < MAX_PANES) if (p.panes[found.pane.id]) |shown| {
+ // A terminal's lines are its logical lines, as a +Search lists them.
+ const n = if (shown.file) |*f| panes.File.nlines(p.gpa, f) else if (shown.isTerminal())
+ if (edit.paneCursorLines(p, &shown.body)) |ls| ls.len else |_| std.math.maxInt(usize)
+ else
+ std.math.maxInt(usize);
+ if (pl.at.line > n) return missedLine(p, id, trimmed, pl.at.line);
+ };
// 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