diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 10:48:36 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 10:57:08 -0300 |
| commit | fc02325789b5a6622f9e577c9a45e65806c516b6 (patch) | |
| tree | 65fdeed6959aef6afe0db5d18df3649aef0d2a34 /src/pardes.zig | |
| parent | 856bf4a8ed36cc6ec38dc9001f753a8838106da2 (diff) | |
| download | pardes-fc02325789b5a6622f9e577c9a45e65806c516b6.tar.gz pardes-fc02325789b5a6622f9e577c9a45e65806c516b6.zip | |
Callstack a plain tree with a depth: CallstackLayout and CallstackCorners go with the inline layout and the square corners (each snippet below its location, the corners rounded, as both defaulted to), and the 100,000-row paging goes: a tree bigger than one answer holds stops there, its last row saying so as at the memory limit, and Callstack run in +Callstack asks nothing (only a file's pane asks a language server) where it showed the next page (lsp.callstack_more, the core's callstack_more, callstackMore and lspRequestAt, the walk's start and cut paths); CallstackDepth stays, as the reference documents it and the user's init sets it; treePrefix reads only the glyphs the tree draws, and the tests that fed it others take the drawn ones; callstack-inline.snap goes with its layout and callstack.snap snaps its style in its stead (its golden gains that section, the text byte-identical); the reference, the guide, the changelog's entry and both builtins lists say so
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 334d66e2..88045147 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -3989,10 +3989,6 @@ pub const Pardes = struct { /// The last query asked (Lspwhy explains it): its kind, argument, and /// the pane and place it was asked at. lsp_last: ?struct { kind: lsp.Kind, arg: Effect.Buf(128), serial: u32, offset: u32 } = null, - /// The Callstack page `+Callstack` shows stopped short: its file's pane, - /// the place it was asked at, and the direct caller the next page starts - /// at. Callstack run in `+Callstack` asks for it. - callstack_more: ?struct { serial: u32, offset: u32, next: Effect.Buf(128) } = null, lsp_wait: ?struct { id: u32, kind: lsp.Kind, @@ -6408,19 +6404,6 @@ pub const Pardes = struct { pub const SavePath = Effect.Buf(effect_path_cap); pub fn lspRequest(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8) void { - p.lspRequestAt(asked, kind, arg_in, null); - } - - /// The next page of the Callstack `+Callstack` shows, asked where the - /// first was. - pub fn callstackMore(p: *Pardes, from: usize) void { - const more = p.callstack_more orelse return p.reportFailure(from, "Callstack: this is the last page; run it in a file to start again"); - const id = p.paneBySerial(more.serial) orelse return p.reportFailure(from, "Callstack: the file it was asked in is closed"); - p.lspRequestAt(id, .callstack, more.next.slice(), more.offset); - } - - /// `lspRequest` at byte `at` of the pane's file rather than its cursor. - fn lspRequestAt(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8, at_byte: ?u32) void { var arg = arg_in; if (!normal.multiOnce(p)) return; // one question per keystroke, from the primary // Lspwhy narrates the last query where it was asked -- that pane's @@ -6444,7 +6427,7 @@ pub const Pardes = struct { (!zig_buf and std.mem.indexOfAny(u8, arg, " \t\r\n\"\\") != null)) return p.reportFailure(id, std.fmt.bufPrint(&said, "Rename: {s} is no name", .{arg}) catch "Rename: no name"); } - var off = if (at_byte) |at| @min(at, if (pane.file) |f| f.content.len else 0) else if (pane.file) |f| modal.offsetAt(f.content, .{ + var off = if (pane.file) |f| modal.offsetAt(f.content, .{ .row = @intCast(@max(0, pane.body.cur_row)), .col = @intCast(@max(0, pane.body.cur_col)), }) else 0; @@ -6760,17 +6743,7 @@ pub const Pardes = struct { return; }; const dir = if (pane.file) |f| panes.Dir.ofName(f.path) else pane.cwdSlice(); - // A Callstack page that stops short ends in its marker: said as a - // row naming the word that shows the next page, and kept. - if (w.kind == .callstack) p.callstack_more = null; - const marker = if (w.kind == .callstack) std.mem.lastIndexOf(u8, rows, lsp.callstack_more) else null; - const content = if (marker) |at| more: { - var fields = std.mem.tokenizeAny(u8, rows[at + lsp.callstack_more.len ..], " \n"); - const next = fields.next() orelse ""; - const shown = fields.next() orelse "?"; - if (p.lsp_last) |last| p.callstack_more = .{ .serial = w.serial, .offset = last.offset, .next = .from(next) }; - break :more std.fmt.allocPrint(p.gpa, "{s}… {s} callers on this page, more after them: Callstack here shows the next page\n", .{ rows[0..at], shown }) catch return; - } else p.gpa.dupe(u8, rows) catch return; + const content = p.gpa.dupe(u8, rows) catch return; const serial_before = p.next_serial; p.fs.refilled = null; panes.Output.fillResults(p, w.pane, dir, from, w.arg.slice(), content, null) catch |err| { @@ -8167,7 +8140,7 @@ test "Callstack always opens and focuses its own pane, reusing it for another sy const source = p.panes[0].?; p.lspRequest(0, .callstack, ""); const first = p.lsp_wait orelse return error.NoRequest; - p.lspResponse(first.id, "└──┬ /test.txt:1:4-7 work\n@callstack-match └─ /test.txt:1:4-7 fn work() {}\n"); + p.lspResponse(first.id, "╰──┬ /test.txt:1:4-7 work\n@callstack-match ╰─ /test.txt:1:4-7 fn work() {}\n"); const report = p.panes[p.active].?; try std.testing.expect(report != source); try std.testing.expect(std.mem.endsWith(u8, report.file.?.path, "/+Callstack")); |
