diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 17:17:51 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 17:19:25 -0300 |
| commit | a89de25fb869c2a21289321aff847431e8552906 (patch) | |
| tree | 52cb69f02af4a1e98963fc6a3130228df320e3b6 /core | |
| parent | f94555e9fe69ee7df19ba8d52f0d63cfebb35e07 (diff) | |
| download | pardes-a89de25fb869c2a21289321aff847431e8552906.tar.gz pardes-a89de25fb869c2a21289321aff847431e8552906.zip | |
Messages: SPC e where jumps walk lands on its place's column, not the line's first (V2's video, pardes bug 2: report.zig:11:9 landed on column 1); THE CAUSE: Messages.act wrote each place as `path:line:col words`, the +Search's locations format (locations.parse, a blank after the column), for the picker too, whose list rows Pick reads with look.parsePathLine, which reads a column with a blank after it as the start of the line's text (`main.zig:100:7 fn main() void {`: line 100, its test), so the picker's landing had the line and no column; the +Search under the pane where jumps open panes read it right; THE FIX: the picker's rows as the compiler wrote them and as Prompt's list rows are, `path:line:col: words`, the +Search's as they were; RUN (TEST FIRST): reproduced with the installed build (the probe's caret at column 1 of report.zig:11); Messages.zig "SPC e lands on its place's column, where jumps walk and where they open a pane" says an error at /test.txt:3:9 and asks SPC e's landing on line 3 column 9 under `Jumps walk` and `Jumps new-pane`: fails on the base at Messages.zig:1899 under walk (expected 8, found 0), passes now; a user hit it on every SPC e; shell-test -Dtest-filter='SPC e' 17/17; load 0.62
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core')
| -rw-r--r-- | core/Messages.zig | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/core/Messages.zig b/core/Messages.zig index 9ba1bc93..4dd39097 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -558,12 +558,17 @@ pub fn act(p: *Pardes, id: usize) void { } if (lead.kind != .@"error" or lead.places_len == 0 or id >= MAX_PANES) return history(p, id); const pane = p.panes[id] orelse return; + const picked = pardes.Pick.asked(p); var rows: std.Io.Writer.Allocating = .init(p.gpa); errdefer rows.deinit(); - for (lead.places[0..lead.places_len]) |*place| rows.writer.print("{s}:{d}:{d} {s}\n", .{ place.path.slice(), place.line, place.col, place.text.slice() }) catch |err| return reportError(p, .at(id), "Message", err); + // A row as its list reads its column: a picker's as the compiler wrote + // it, `path:line:col: words` (Prompt's rows too: a column with a blank + // after it is the line's text to look.parsePathLine), a +Search's as + // its locations are, `path:line:col words` (locations.parse). + for (lead.places[0..lead.places_len]) |*place| rows.writer.print("{s}:{d}:{d}{s} {s}\n", .{ place.path.slice(), place.line, place.col, if (picked) ":" else "", place.text.slice() }) catch |err| return reportError(p, .at(id), "Message", err); const cause = lead.src; const content = rows.toOwnedSlice() catch |err| return reportError(p, .at(id), "Message", err); - if (pardes.Pick.asked(p)) { + if (picked) { defer p.gpa.free(content); // The cause cut at a character's start to the word's room. const src = cause.slice(); @@ -1875,3 +1880,27 @@ test "SPC e keeps the error it walks: the file it lands in, not open when the er } else return error.LineNotShown; try std.testing.expect(std.mem.indexOf(u8, marked, "var s = 1; \u{2717} local variable is never mutated") != null); } + +test "SPC e lands on its place's column, where jumps walk and where they open a pane" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 30 }); + defer p.deinit(); + const pane = try p.setTestFile("one\ntwo\n var s = 1;\nfour\n"); + for ([_]config.Settings.Jumps{ .walk, .@"new-pane" }) |jumps| { + p.settings.jumps = jumps; + p.view().active = p.paneBySerial(pane.serial).?; + pane.body.cur_row = 0; + pane.body.cur_col = 0; + p.messages.live_len = 0; + const err = keep(p, .@"error", 0, "@p9 zig build", "exit 2"); + err.places[0] = .{ .line = 3, .col = 9 }; + err.places[0].path.set("/test.txt"); + err.places[0].text.set("local variable is never mutated"); + err.places_len = 1; + for (" e") |c| p.update(.{ .key = .{ .cp = c } }); + while (p.nextEffect()) |_| {} + const landed = p.panes[p.view().active].?; + try std.testing.expectEqualStrings("/test.txt", landed.file.?.path); + try std.testing.expectEqual(@as(i32, 2), landed.body.cur_row); + try std.testing.expectEqual(@as(i32, 8), landed.body.cur_col); + } +} |
