summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 14:05:34 -0300
committerGabriel Schneider <[email protected]>2026-10-24 15:56:58 -0300
commit8f5871340b87a0d5399967ccc7eac0d12dc10821 (patch)
tree96257104c2384c2c8f08b69a958228f67daab6ea /src/File.zig
parentce6ba3d8a9e1f5c1e31892639049317f6a27b1bc (diff)
downloadpardes-8f5871340b87a0d5399967ccc7eac0d12dc10821.tar.gz
pardes-8f5871340b87a0d5399967ccc7eac0d12dc10821.zip
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
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig16
1 files changed, 11 insertions, 5 deletions
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 {