summaryrefslogtreecommitdiff
path: root/core/Output.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Output.zig')
-rw-r--r--core/Output.zig18
1 files changed, 12 insertions, 6 deletions
diff --git a/core/Output.zig b/core/Output.zig
index 380fadb1..b64d2ff3 100644
--- a/core/Output.zig
+++ b/core/Output.zig
@@ -491,16 +491,23 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, name: ?[]c
pub fn openJumps(p: *Pardes, id: usize) !void {
var out: std.Io.Writer.Allocating = .init(p.gpa);
errdefer out.deinit();
+ try jumpsText(p, &out.writer);
+ try refillOrOpen(p, id, .{ .cmd = .Jumplist }, try out.toOwnedSlice());
+}
+
+/// The live view's jump list as a +Jumps lists it, a place a row, the
+/// oldest first (its picker's rows too, Pick.zig).
+pub fn jumpsText(p: *Pardes, w: *std.Io.Writer) !void {
for (p.view().jumps.list[0..p.view().jumps.n]) |j| {
// A closed file's entry: marked, and a look at it opens it again.
if (j.serial == 0) {
const e = p.recentByHash(j.path_hash) orelse continue;
// A kind's place has no Look's column.
if (j.place.len > 0) {
- try out.writer.print("{s}:{d} (closed)\n", .{ e.path, @max(1, j.line) });
+ try w.print("{s}:{d} (closed)\n", .{ e.path, @max(1, j.line) });
continue;
}
- try out.writer.print("{s}:{d}:{d} (closed)\n", .{ e.path, @max(1, j.line), @max(1, j.col) });
+ try w.print("{s}:{d}:{d} (closed)\n", .{ e.path, @max(1, j.line), @max(1, j.col) });
continue;
}
const jp = p.panes[j.pane] orelse continue;
@@ -520,13 +527,12 @@ pub fn openJumps(p: *Pardes, id: usize) !void {
var cut = @min(what.len, 120);
while (cut > 0 and cut < what.len and what[cut] & 0xc0 == 0x80) cut -= 1;
if (j.line == 0)
- try out.writer.print("{s} {s}\n", .{ loc, what[0..cut] })
+ try w.print("{s} {s}\n", .{ loc, what[0..cut] })
else if (j.place.len > 0)
- try out.writer.print("{s}:{d} {s}\n", .{ loc, j.line, what[0..cut] })
+ try w.print("{s}:{d} {s}\n", .{ loc, j.line, what[0..cut] })
else
- try out.writer.print("{s}:{d}:{d} {s}\n", .{ loc, j.line, j.col, what[0..cut] });
+ try w.print("{s}:{d}:{d} {s}\n", .{ loc, j.line, j.col, what[0..cut] });
}
- try refillOrOpen(p, id, .{ .cmd = .Jumplist }, try out.toOwnedSlice());
}
/// The state file's dumps (Db.listDumps: label, date, size, pane count,