From 8f5871340b87a0d5399967ccc7eac0d12dc10821 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 14:05:34 -0300 Subject: Tables 2/3: the look, a table's pipes drawn as rules, its delimiter row one rule with its colons kept, its header bold on the tag's ground (glyphs and colours on the cells there, nothing moved); the GUI draws light box-drawing rules edge to edge so they join across rows --- src/File.zig | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/File.zig') diff --git a/src/File.zig b/src/File.zig index ddf91af3..5db04443 100644 --- a/src/File.zig +++ b/src/File.zig @@ -587,12 +587,18 @@ test "indexed source rows match uncached scans across content changes" { /// else none. Every mapping between a file row's bytes and its cells goes /// through here, so the drawn row, the caret and a click cannot disagree. pub fn rowPads(pane: *const Pane, row: i32, out: *[Tables.max_pads]Tables.Pad) []const Tables.Pad { - const f = if (pane.file) |*file| file else return &.{}; - if (row < 0 or f.tables.list.items.len == 0 or !f.tables.current(f)) return &.{}; - const table = f.tables.find(@intCast(row)) orelse return &.{}; + const table = rowTable(pane, row) orelse return &.{}; + return pane.file.?.tables.padsOf(table, sourceLine(pane, row), out); +} + +/// The table `row` is laid out in, in this pane (`rowPads`). +pub fn rowTable(pane: *const Pane, row: i32) ?*const Tables.Table { + const f = if (pane.file) |*file| file else return null; + if (row < 0 or f.tables.list.items.len == 0 or !f.tables.current(f)) return null; + const table = f.tables.find(@intCast(row)) orelse return null; const width = wrapWidth(pane, pane.body_wrapped); - if (width > 0 and table.width > width) return &.{}; - return f.tables.padsOf(table, sourceLine(pane, row), out); + if (width > 0 and table.width > width) return null; + return table; } pub fn displayOffset(pane: *const Pane, row: i32, from_raw: i32, to_raw: i32) i32 { -- cgit v1.3