From 1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 8 Oct 2026 12:03:46 -0300 Subject: Add a readable static Callstack pane and align tagline text --- src/look.zig | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/look.zig') diff --git a/src/look.zig b/src/look.zig index 5795979f..1065cb02 100644 --- a/src/look.zig +++ b/src/look.zig @@ -524,7 +524,7 @@ pub fn cursorWordSel(p: *Pardes, pane: *Pane) Pane.Sel { const w = pane.wrapRow(pane.body.cur_row, pane.body.cur_col); const vrow = w.row + @as(i32, pane.tag_rows); const vcol = if (pane.file != null) - panes.File.displayOffset(pane, pane.body.cur_row, w.at, pane.body.cur_col) + @as(i32, panes.File.gutterWidth(pane)) + w.pad + panes.File.displayOffset(pane, pane.body.cur_row, w.at, pane.body.cur_col) + @as(i32, panes.File.gutterWidth(pane)) else blk: { const lines = edit.paneCursorLines(p, &pane.body) catch break :blk pane.body.cur_col; const local = pane.body.cur_row; @@ -892,7 +892,13 @@ fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usiz if (grain == .whole) break :span wholeRowSpan(ln); if (pane.file) |f| if (@as(usize, @intCast(r)) < f.location_rows.len) { const end = f.location_rows[@intCast(r)].location_end; - if (end > 0) break :span @as(?Span, .{ .start = 0, .end = end }); + if (end > 0) { + const start_byte = if (f.output != null and std.meta.eql(f.output.?.from, panes.Output.Origin{ .query = .callstack })) + @import("locations.zig").treePrefix(ln).end + else + 0; + break :span @as(?Span, .{ .start = start_byte, .end = end }); + } }; break :span lineSpan(p, ln, dir, &realbuf); } orelse continue; @@ -1057,6 +1063,7 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at: Spot, landing: enum { center, ke if (id >= MAX_PANES) return; const pane = p.panes[id] orelse return; p.active = id; + if (pane.collapsed) layout.toggleCollapse(p, id); pane.body.normal.clear(); if (pane.hasPdf()) { if (landing == .keep) return; @@ -2677,7 +2684,7 @@ test "Incl's directories find a name found nowhere else, too; bare Incl l try std.testing.expectEqual(@as(usize, 0), p.incl.items.len); } -test "n in a command pane walks its own file:line places, whoever walked last" { +test "LookNext in a command pane walks its own file:line places, whoever walked last" { if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -2706,12 +2713,12 @@ test "n in a command pane walks its own file:line places, whoever walked last" { cmd.focus = .body; cmd.body.mode = .normal; for ([_]u21{ 'g', 'g' }) |cp| p.update(.{ .key = .{ .cp = cp } }); - p.update(.{ .key = .{ .cp = 'n' } }); + exec.runBuiltin(p, .LookNext, p.active, "", null); try std.testing.expectEqual(dst, p.active); const first = cmd.look_at orelse return error.NoSpot; const lines = try edit.paneCursorLines(p, &cmd.body); try std.testing.expect(std.mem.startsWith(u8, lines[@intCast(first.row)][@intCast(first.col0)..], "x.c:3:1")); - p.update(.{ .key = .{ .cp = 'n' } }); + exec.runBuiltin(p, .LookNext, p.active, "", null); try std.testing.expectEqual(dst, p.active); const second = cmd.look_at orelse return error.NoSpot; try std.testing.expect(std.mem.startsWith(u8, lines[@intCast(second.row)][@intCast(second.col0)..], "y.c:2:1")); -- cgit v1.3