summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 13:59:21 -0300
committerGabriel Schneider <[email protected]>2026-10-24 15:56:58 -0300
commitce6ba3d8a9e1f5c1e31892639049317f6a27b1bc (patch)
tree939446ce2794e49ba950fa29acfa69292485288f /src/edit.zig
parent05d03191a8bfdb7c76176a91fddd97f389ab6dc3 (diff)
downloadpardes-ce6ba3d8a9e1f5c1e31892639049317f6a27b1bc.tar.gz
pardes-ce6ba3d8a9e1f5c1e31892639049317f6a27b1bc.zip
Tables 1/3: a markdown file's pipe tables laid out in their rows, cells padded with virtual width before a byte (a tab's extra cells, not a parallel map): File.rowPads under displayOffset/displayEndOffset/byteAtRowDisplay, fillBody, recolorSyntax, the pointer sweep, j/k; tree-sitter-markdown as the detector's oracle
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/edit.zig b/src/edit.zig
index a06f5f2d..74dd0d1d 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -250,8 +250,15 @@ pub fn capturePointerSelection(p: *Pardes, pane: *Pane, slot: usize) !void {
if (raw) next = .{ .line = source.line + 1, .at = 0 };
const end = if (next.line == source.line) @min(line.len, @as(usize, @intCast(@max(0, next.at)))) else line.len;
const start: usize = @intCast(@max(0, source.at));
- const lo = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, left - prefix - source.pad))));
- const at = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, right - prefix - source.pad))));
+ // A file row through its table pads (File.rowPads), as it is drawn.
+ const lo: usize = @min(end, if (pane.file != null and !raw)
+ @as(usize, @intCast(panes.File.byteAtRowDisplay(pane, source.line, source.at, @max(0, left - prefix - source.pad))))
+ else
+ panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, left - prefix - source.pad))));
+ const at: usize = @min(end, if (pane.file != null and !raw)
+ @as(usize, @intCast(panes.File.byteAtRowDisplay(pane, source.line, source.at, @max(0, right - prefix - source.pad))))
+ else
+ panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, right - prefix - source.pad))));
row.* = .{
.row = source.line,
.lo = lo,