summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 00:35:08 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitd7b3d57ed0ba649f01559356fbf2bf89561990ca (patch)
tree37c95f8c04fd86961197a54adbb920675034d98a /src/Output.zig
parent218d574b59abd7fb8dd6fe027b12927fc31c3506 (diff)
downloadpardes-d7b3d57ed0ba649f01559356fbf2bf89561990ca.tar.gz
pardes-d7b3d57ed0ba649f01559356fbf2bf89561990ca.zip
rows: a pane's rows from outside, one definition and two sinks: File.setRows is the one writer of a pane's rows (locations.Row, the stored form as it was: digest, dump and blobs unchanged), refusing what its text cannot hold (more rows than lines, an offset or styles past a line's end) and keeping the painting of equal rows; Output.fillRows keeps what is the editor's (the pane, its refill identity, the steps) and hands its rows to it, as the query panes' three writers do; locations.formatRows and parseRows are its text, a line a row, fields a blank apart and the path last (kind m c p with d and u, line col end_line end_col source_column location_end code_start, styles as `-` or `N:start+len=role,...` a role a syntax class and grounds joined by dots); each pane directory over 9P has `rows`, read as that text (+Search's, +Callstack's addresses as data) and written whole lines at a time, at 0 replacing and later following (a line cut by a mount waits for its open's next write; tree.writeLines passes a line on at the offset it was begun at), `>` emptying them; tests: the rows of a +Search, a +Callstack and a +Diff read back from their text equal, byte for byte, and the file read, written whole and across writes, refused and emptied; README, reference and changelog say so
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 5bad7ab7..3bcc3fa5 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -452,16 +452,10 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, name: ?[]c
File.setContent(p, rf, result_content);
resetBody(p, rp);
}
- if (locations.equalRows(rf.location_rows, result_rows)) {
+ File.setRows(p, rf, result_rows) catch |err| {
locations.freeRows(p.gpa, result_rows);
- } else {
- locations.freeRows(p.gpa, rf.location_rows);
- rf.location_rows = result_rows;
- if (rf.highlights.len > 0) p.tree_sitter_gpa.free(rf.highlights);
- rf.highlights = &.{};
- rf.highlight_start = 0;
- rf.syntax_dirty = true;
- }
+ p.reportError(id, "rows", err);
+ };
p.view().active = id;
if (traits(from).steps) {
pane.search_pane = i;
@@ -478,7 +472,10 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, name: ?[]c
p.gpa.free(np.file.?.path);
np.file.?.path = owned;
}
- np.file.?.location_rows = result_rows;
+ File.setRows(p, &np.file.?, result_rows) catch |err| {
+ locations.freeRows(p.gpa, result_rows);
+ p.reportError(id, "rows", err);
+ };
layout.placeNew(p, id, id, free, .doc);
p.view().active = id;
if (traits(from).steps) {