summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:56:53 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:13:33 -0300
commitd1d5d3cfb18841604bba2057eeb3598f729b4475 (patch)
tree298c29ab8767852bf74eb86ad4d15acc4348f109 /src/Output.zig
parent33037ece5af9ae1c7048819bbbae3fc5e6fc4ade (diff)
downloadpardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.tar.gz
pardes-d1d5d3cfb18841604bba2057eeb3598f729b4475.zip
client #1, the views indexed: a view's share of the session is Pardes.View (the ~42 fields views.fields named: size, cell metrics, columns, rects, focus, jumps, pointer, gestures, prefixes, frontend), one of Pardes.views[4] (null when closed), the live one views[live] through Pardes.view() (index field `view` renamed `live`); going into another view is the index plus the panes' shares, which stay swapped (park and unpark now move only Pane.pv); views.zig loses fields, Part over Pardes, Parked, kept, emptied and the session half of every copy, and a pane closing leaves every view's layout at once (views.gone, at the two places a slot is freed) instead of the serials each parked view kept; drawOne and within put the drawn view's own share back whole; the views are in the digest now (tape's per-field parts name views[k].field), so a fresh view's col_x/col_w default to zeros, not undefined; the dump keeps every open view in the core and the panes' shares of the others under `shares`; an image from before (live view as the core's own fields, the rest under `views`) loads them into views[] once; the ~2,400 references rewritten mechanically from the compiler's errors (p.active is p.view().active, `const v = p.view()` hoisted in 823 places), Kind.zig (4 lines) and addon_test.zig (3) among them, macos.zig by pattern (not compiled here); tape's watched host writes read the live view's frontend and active; perf.zig's accessor lines change its harness hash, the debug baselines re-keyed to it (their numbers the base's); no golden changes; gates: core-test 956/956 both, unit-test 1487/1488 tui and 1530/1531 gui, behaviour-test 248/248 both, pane-test 171/172, snap all 105 ok, process-test 0 of 37 failed tui, replicas ok
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/Output.zig b/src/Output.zig
index ecd0666b..006ab7bd 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -488,7 +488,7 @@ pub fn fillResults(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []
try setArg(output, arg);
p.gpa.free(content);
p.fs.refilled = rp.serial;
- p.active = id;
+ p.view().active = id;
if (traits(from).steps) {
pane.search_pane = i;
pane.search_row = anchor;
@@ -552,7 +552,7 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []con
rf.highlight_start = 0;
rf.syntax_dirty = true;
}
- p.active = id;
+ p.view().active = id;
if (traits(from).steps) {
pane.search_pane = i;
pane.search_row = anchor;
@@ -564,7 +564,7 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []con
const np = try open(p, free, dir, from, arg, result_content);
np.file.?.location_rows = result_rows;
exec.placeNew(p, id, id, free, .doc);
- p.active = id;
+ p.view().active = id;
if (traits(from).steps) {
pane.search_pane = free;
pane.search_row = anchor;
@@ -606,7 +606,7 @@ pub fn showDiffText(p: *Pardes, id: usize, source: []const u8) void {
}
if (newest) |i| {
if (p.panes[i].?.collapsed) layout.toggleCollapse(p, i);
- p.active = i;
+ p.view().active = i;
return;
}
p.look_text = true;
@@ -626,7 +626,7 @@ pub fn diffSource(p: *Pardes, f: *const File.State) ?[]const u8 {
pub fn openJumps(p: *Pardes, id: usize) !void {
var out: std.Io.Writer.Allocating = .init(p.gpa);
errdefer out.deinit();
- for (p.jumps.list[0..p.jumps.n]) |j| {
+ 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;
@@ -720,7 +720,7 @@ pub fn openUnsaved(p: *Pardes, id: usize, content: []u8) void {
const free = p.freeSlot() orelse return p.gpa.free(content);
_ = open(p, free, dir, .unsaved, "", content) catch return;
exec.placeNew(p, id, id, free, .doc);
- p.active = id;
+ p.view().active = id;
}
/// `pardes -`'s pane: a new `<dir>/+Pager` for each paged text, as each
@@ -749,12 +749,12 @@ pub fn openPager(p: *Pardes, from: usize, dir_arg: []const u8) !usize {
pane.file.?.path = path;
pane.file.?.pager = true;
pane.tty_filter = true;
- const keyboard = p.active;
+ const keyboard = p.view().active;
exec.placeNew(p, from, null, free, .fs);
if (p.unplaced.isSet(free)) return error.NoPaneRoom;
// Shown, not asked for: the keyboard stays where it was, as a command
// pane's does.
- if (p.panes[keyboard] != null) p.active = keyboard;
+ if (p.panes[keyboard] != null) p.view().active = keyboard;
return free;
}
@@ -857,7 +857,7 @@ fn openStepped(p: *Pardes, id: usize, from: Origin, content: []u8) !void {
const free = p.freeSlot() orelse return error.NoPaneSlots;
_ = try open(p, free, dir, from, "", content);
exec.placeNew(p, id, id, free, .doc);
- p.active = id;
+ p.view().active = id;
pane.search_pane = free;
pane.search_row = null;
look.armLookWalk(p, free);
@@ -1002,7 +1002,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
.theme_file = pardes.colors.loadedThemeFile(p),
.compiled_default_shell = config.defaultShell(),
.hover_delay_frames = config.look_preview_delay_frames,
- .native_images = p.frontend.native_images,
+ .native_images = p.view().frontend.native_images,
.capabilities = builtins.viewCapabilities(p),
.state = &p.settings,
});
@@ -1043,6 +1043,7 @@ pub fn openErrors(p: *Pardes, id: usize, content: []u8) !void {
}
pub fn resetBody(p: *Pardes, pane: *Pane) void {
+ const v = p.view();
pane.file.?.scroll = 0;
pane.body.cur_row = 0;
pane.body.cur_col = 0;
@@ -1064,7 +1065,7 @@ pub fn resetBody(p: *Pardes, pane: *Pane) void {
if (p.look_hover_preview) |preview| if (preview.serial == pane.serial) {
p.look_hover_preview = null;
};
- if (p.drag == .select and p.panes[p.drag.select.id] == pane) p.drag = .none;
+ if (v.drag == .select and p.panes[v.drag.select.id] == pane) v.drag = .none;
}
fn openRead(p: *Pardes, id: usize, from: Origin, arg: []const u8, content: []u8) !void {
@@ -1078,7 +1079,7 @@ fn openRead(p: *Pardes, id: usize, from: Origin, arg: []const u8, content: []u8)
try setArg(ho, arg);
File.setContent(p, hf, content);
resetBody(p, hp);
- p.active = i;
+ p.view().active = i;
return;
}
// Where the word ran: the pane's directory, or from a column's or the
@@ -1087,5 +1088,5 @@ fn openRead(p: *Pardes, id: usize, from: Origin, arg: []const u8, content: []u8)
const free = p.freeSlot() orelse return error.NoPaneSlots;
_ = try open(p, free, dir, from, arg, content);
exec.placeNew(p, id, id, free, if (from == .errors) .errors else .doc);
- p.active = free;
+ p.view().active = free;
}