summaryrefslogtreecommitdiff
path: root/src/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/panes.zig')
-rw-r--r--src/panes.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/panes.zig b/src/panes.zig
index 89362996..ba1dedb5 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -219,6 +219,7 @@ pub const Pane = struct {
// Visible rows map to source lines and raw/display column origins.
wrap_line: [limits.wrap_rows]i32 = undefined,
wrap_col: [limits.wrap_rows]i32 = undefined,
+ wrap_pad: [limits.wrap_rows]u16 = @splat(0),
wrap_n: u16 = 0,
/// A row map also exists for sticky headers when soft wrapping is off.
body_wrapped: bool = false,
@@ -493,15 +494,15 @@ pub const Pane = struct {
return pane.surfRow(terminal.gridOffset(pane));
}
- pub fn wrapAt(pane: *Pane, vr: i32) struct { line: i32, at: i32 } {
+ pub fn wrapAt(pane: *Pane, vr: i32) struct { line: i32, at: i32, pad: i32 = 0 } {
if (pane.wrap_n > 0 and vr >= 0 and vr < @as(i32, pane.wrap_n))
- return .{ .line = pane.wrap_line[@intCast(vr)], .at = pane.wrap_col[@intCast(vr)] };
+ return .{ .line = pane.wrap_line[@intCast(vr)], .at = pane.wrap_col[@intCast(vr)], .pad = pane.wrap_pad[@intCast(vr)] };
// unwrapped: rows ARE lines, and the byte column a row starts at is the
// horizontal scroll (always 0 on a terminal, which never has one)
return .{ .line = pane.scroll() + vr, .at = pane.hscroll };
}
- pub fn wrapRow(pane: *Pane, line: i32, col: i32) struct { row: i32, at: i32 } {
+ pub fn wrapRow(pane: *Pane, line: i32, col: i32) struct { row: i32, at: i32, pad: i32 = 0 } {
if (pane.wrap_n == 0) return .{ .row = line - pane.scroll(), .at = pane.hscroll };
var i: u16 = 0;
while (i < pane.wrap_n) : (i += 1) {
@@ -509,7 +510,7 @@ pub const Pane = struct {
// the LAST row of a line owns every column past its start, so a
// cursor parked on the trailing newline still has somewhere to draw
if (i + 1 < pane.wrap_n and pane.wrap_line[i + 1] == line and col >= pane.wrap_col[i + 1]) continue;
- return .{ .row = @intCast(i), .at = pane.wrap_col[i] };
+ return .{ .row = @intCast(i), .at = pane.wrap_col[i], .pad = pane.wrap_pad[i] };
}
return .{ .row = -1, .at = 0 };
}