summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig33
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"));