summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 01797cbe..4aa0c021 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -606,17 +606,22 @@ pub fn openJumps(p: *Pardes, id: usize) !void {
else
try out.writer.print("{s}:{d}:{d} {s}\n", .{ loc, j.line, j.col, what[0..cut] });
}
- const content = try out.toOwnedSlice();
- try openStepped(p, id, .{ .cmd = .Jumplist }, content);
+ try refillOrOpen(p, id, .{ .cmd = .Jumplist }, try out.toOwnedSlice());
}
/// The recent list as rows: `<path>:<line>:<col> open|closed`, most recent
/// first; a look at a row opens the file there, as a +Jumps row does.
pub fn recentText(p: *Pardes, w: *std.Io.Writer, look_rows: bool) !void {
- for (p.recent.entries.items) |e| {
+ for (p.recent.entries.items) |stored| {
+ // An open one's row is where it is now, not where it last closed.
+ var e = stored;
var is_open = false;
- for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output == null and std.mem.eql(u8, f.path, e.path)) {
+ for (p.panes) |slot| if (slot) |pane| if (Pardes.recentPlace(pane)) |d| if (std.mem.eql(u8, d.path, e.path)) {
is_open = true;
+ e.line = d.line;
+ e.col = d.col;
+ e.aline = d.aline;
+ e.acol = d.acol;
};
const state: []const u8 = if (is_open) "open" else "(closed)";
if (!look_rows) {
@@ -699,12 +704,17 @@ pub fn openRecent(p: *Pardes, id: usize) !void {
var out: std.Io.Writer.Allocating = .init(p.gpa);
errdefer out.deinit();
try recentText(p, &out.writer, true);
- const content = try out.toOwnedSlice();
+ try refillOrOpen(p, id, .{ .cmd = .Recent }, try out.toOwnedSlice());
+}
+
+/// The one stepped output from `from`, filled again with `content` when it
+/// is there (Recent, Jumplist), or opened when it is not.
+fn refillOrOpen(p: *Pardes, id: usize, from: Origin, content: []u8) !void {
for (p.panes, 0..) |slot, i| {
const rp = slot orelse continue;
const rf = if (rp.file) |*f| f else continue;
const o = rf.output orelse continue;
- if (!std.meta.eql(o.from, Origin{ .cmd = .Recent })) continue;
+ if (!std.meta.eql(o.from, from)) continue;
File.setContent(p, rf, content);
resetBody(p, rp);
p.fs.refilled = rp.serial;
@@ -715,7 +725,7 @@ pub fn openRecent(p: *Pardes, id: usize) !void {
look.armLookWalk(p, i);
return;
}
- try openStepped(p, id, .{ .cmd = .Recent }, content);
+ try openStepped(p, id, from, content);
}
pub fn openThemes(p: *Pardes, id: usize) !void {
@@ -870,6 +880,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
.startup_config_path = p.opts.startup_config_path,
.platform = @tagName(pardes.platform),
.theme_name = p.theme().name,
+ .theme_file = pardes.colors.loadedThemeFile(p),
.compiled_default_shell = config.defaultShell(),
.hover_delay_frames = config.look_preview_delay_frames,
.native_images = p.native_images,