From 5db9e71ba32dd6f0a0292eaa341d1d8ba805483c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 11:09:17 -0300 Subject: A remembered place is clamped to the file as it is now, its selection's two ends kept A Recent row or a jumplist entry for a line the file no longer has failed the look; now it opens at the last line. The selection's anchor is remembered too, so a reopen restores both ends where they fit, and Recent and Jumplist share the (closed) marker. Co-Authored-By: Claude Opus 5.5 --- src/Output.zig | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/Output.zig') diff --git a/src/Output.zig b/src/Output.zig index 3b8e6a7a..e6d6f46c 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -555,13 +555,20 @@ pub fn recentText(p: *Pardes, w: *std.Io.Writer, look_rows: bool) !void { for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output == null and std.mem.eql(u8, f.path, e.path)) { is_open = true; }; - const state: []const u8 = if (is_open) "open" else "closed"; - if (!look_rows) - try w.print("{s} {s}\n", .{ state, e.path }) - else if (e.line == 0) - try w.print("{s} {s}\n", .{ e.path, state }) - else + const state: []const u8 = if (is_open) "open" else "(closed)"; + if (!look_rows) { + try w.print("{s} {s}\n", .{ if (is_open) "open" else "closed", e.path }); + } else if (e.line == 0) { + try w.print("{s} {s}\n", .{ e.path, state }); + } else if (e.aline != 0 and (e.aline != e.line or e.acol != e.col)) { + // A selection: both its ends, in order, `path:L:C-L2:C2`. + const a_first = e.aline < e.line or (e.aline == e.line and e.acol < e.col); + const s = if (a_first) [2]u32{ e.aline, e.acol } else [2]u32{ e.line, e.col }; + const t = if (a_first) [2]u32{ e.line, e.col } else [2]u32{ e.aline, e.acol }; + try w.print("{s}:{d}:{d}-{d}:{d} {s}\n", .{ e.path, s[0], s[1], t[0], t[1], state }); + } else { try w.print("{s}:{d}:{d} {s}\n", .{ e.path, e.line, e.col, state }); + } } } -- cgit v1.3