diff options
Diffstat (limited to 'src/Output.zig')
| -rw-r--r-- | src/Output.zig | 19 |
1 files changed, 13 insertions, 6 deletions
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 }); + } } } |
