diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 14:52:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 14:56:07 -0300 |
| commit | c6dc2a6148855e0f02e86103dd80f47525a985e4 (patch) | |
| tree | b8f5b4fc9da0aac4786fe3e7c04f3b979b304911 /core/panes.zig | |
| parent | f7f6b564c0f43aaa31233dcdf1ae7daf24799fe1 (diff) | |
| parent | 70fcd1b561f6f18e95101633a0f1bcd3f30a0247 (diff) | |
| download | pardes-c6dc2a6148855e0f02e86103dd80f47525a985e4.tar.gz pardes-c6dc2a6148855e0f02e86103dd80f47525a985e4.zip | |
walk UI M10: F1's three fixes (pmqrrmvm a picker previews its first row from the frame its rows come; zzxpztus C-r's history has the band's cursor; qxkzuoyq f7f6b564c0f4 a rolled level that wraps keeps its hints on its last row) and F2's four (nxorurnk a cause longer than its word keeps the path's end; qkynmxtw a message too wide for the notice row gives way by its items, ten goldens; qypmxlxx no `exit N` in a failed run's detail; mkwywzon 70fcd1b561f6 a pane's mark is its window button's glyph) merged onto M9 (svssokqn), resolved by meaning: no text conflict and no file in common (F1: core/Pick.zig, Prompt.zig, TagState.zig; F2: core/Messages.zig, colors.zig, panes.zig, dev/gui/gui.zig and the ten process-test goldens), and none reads what the other changed: F1's head hints and history rows are the tag's and the band's, F2's cuts the notice row's and the window's button, so the two stacks' tests hold each other's trees as they were written; core-test 1102/1273 (171 skipped: M9's 1097 + F1's three tests + F2's two), load 3.4 to 7
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/panes.zig')
| -rw-r--r-- | core/panes.zig | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/core/panes.zig b/core/panes.zig index 6fcb15b6..fe127acd 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -1071,6 +1071,14 @@ pub const Pane = struct { } var buf: [16]u8 = undefined; const code = if (status) |n| std.fmt.bufPrint(&buf, "{d}", .{n}) catch unreachable else "?"; // an exit status fits 16 + // A failed run's last rows, read before its `exit N` goes under + // them: a report's places are at its end, and its detail is the + // tool's lines, not the run's status (UX F2). + const rows: ?[]const []const u8 = if (status == 0) null else if (pane.terminal) |state| read: { + const grid = Term.grid(state); + const first = grid.total -| 400; + break :read Term.editRows(state, p.scratch.allocator(), first, grid.total - first) catch null; + } else null; var said: pardes.Kind.Buf(32) = .{}; const lead = if (Term.grid(pane.terminal).cursor_x != 0) "\r\n" else ""; pane.feedOutput(p, said.print("{s}exit {s}\r\n", .{ lead, code })); @@ -1078,21 +1086,17 @@ pub const Pane = struct { p.needs_frame = true; // A failed run whose report names places (a compiler's // `path:line:col: error: ...`): an error of this pane, the places - // its words, the rows after its first its detail (SPEC §10.2). Its - // last rows only: a report's places are at its end. - if (status != 0) if (pane.terminal) |state| report: { - const grid = Term.grid(state); - const first = grid.total -| 400; - const rows = Term.editRows(state, p.scratch.allocator(), first, grid.total - first) catch break :report; + // its words, the rows after its first its detail (SPEC §10.2). + if (rows) |report_rows| report: { var found: pardes.Messages.Said = .{}; - if (pardes.Messages.readPlaces(&found, pane.cwdSlice(), rows) == 0) break :report; + if (pardes.Messages.readPlaces(&found, pane.cwdSlice(), report_rows) == 0) break :report; var words: pardes.Kind.Buf(32) = .{}; const kept = pardes.Messages.say(p, .@"error", id, words.print("exit {s}", .{code})); kept.places = found.places; kept.places_len = found.places_len; kept.detail = found.detail; kept.detail_len = found.detail_len; - }; + } } }; @@ -1981,6 +1985,9 @@ test "a command whose run fails naming places is an error of its pane, those pla try std.testing.expectEqual(@as(u8, 1), said.places_len); try std.testing.expectEqualStrings("/tmp/pardes-cmd/core/pick.zig", said.places[0].path.slice()); try std.testing.expectEqualStrings(" const best = rank(q, name, 3);", said.detail[0].slice()); + // The tool's lines alone: pardes's own `exit 1` under them is the run's + // status, in the command's tag and on the notice row (UX F2). + try std.testing.expectEqual(@as(u8, 1), said.detail_len); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); const s = try p.render(frame.allocator()); |
