summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/panes.zig b/core/panes.zig
index fe57793a..cdc28dba 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -563,8 +563,8 @@ pub const Pane = struct {
return pane.surfRow(@as(i32, @intCast(Term.grid(pane.terminal).offset)) + pane.pan);
}
- pub fn wrapAt(pane: *Pane, vr: i32) struct { line: i32, at: i32, pad: i32 = 0 } {
- File.geometry(pane);
+ pub fn wrapAt(pane: *Pane, tab: u16, vr: i32) struct { line: i32, at: i32, pad: i32 = 0 } {
+ File.geometry(tab, pane);
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)], .pad = pane.wrap_pad[@intCast(vr)] };
// unwrapped: rows ARE lines, and the byte column a row starts at is the
@@ -572,8 +572,8 @@ pub const Pane = struct {
return .{ .line = pane.scroll() + vr, .at = pane.hscroll };
}
- pub fn wrapRow(pane: *Pane, line: i32, col: i32) struct { row: i32, at: i32, pad: i32 = 0 } {
- File.geometry(pane);
+ pub fn wrapRow(pane: *Pane, tab: u16, line: i32, col: i32) struct { row: i32, at: i32, pad: i32 = 0 } {
+ File.geometry(tab, pane);
if (pane.wrap_n == 0) return .{ .row = line - pane.scroll(), .at = pane.hscroll };
var i: u16 = 0;
while (i < pane.wrap_n) : (i += 1) {
@@ -614,8 +614,8 @@ pub const Pane = struct {
return false;
}
- pub fn ensureCursorVisible(pane: *Pane) void {
- File.geometry(pane);
+ pub fn ensureCursorVisible(pane: *Pane, tab: u16) void {
+ File.geometry(tab, pane);
const off = pane.scroll();
var in_context = false;
// The map is the view's as it is now (File.geometry): an ancestor is
@@ -663,14 +663,14 @@ pub const Pane = struct {
// Measured from the view's left edge to the caret, never from the
// line's start: a 500 KB line was walked from byte 0 at every key
// (widths add, so the span alone is exact).
- const apart = File.lineDisplayOffset(line, raw_scroll, raw_cur);
+ const apart = File.lineDisplayOffset(tab, line, raw_scroll, raw_cur);
const back: ?i32 = if (apart < hmargin) hmargin else if (apart > w - 1 - hmargin) w - 1 - hmargin else null;
if (back) |cols| {
// The byte `cols` columns before the caret, looked for from a
// few bytes a column back (a grapheme is at most 4 a column).
const from = raw_cur -| @as(usize, @intCast(cols)) * 4;
- const ahead = File.lineDisplayOffset(line, from, raw_cur) - cols;
- pane.hscroll = @intCast(if (ahead <= 0) from else File.byteAtDisplayFrom(line, from, @intCast(ahead)));
+ const ahead = File.lineDisplayOffset(tab, line, from, raw_cur) - cols;
+ pane.hscroll = @intCast(if (ahead <= 0) from else File.byteAtDisplayFrom(tab, line, from, @intCast(ahead)));
}
}
}