summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
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,