summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 76854dbc..7e9cf7e7 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -124,9 +124,9 @@ fn cellOf(row: i32, col: i32) modal.Cursor {
pub fn dotOf(pane: *Pane) State.Range {
const text = bodyOf(pane);
- const head = modal.offsetAt(text, cellOf(pane.cur_row, pane.cur_col));
- if (!pane.vsel.active) return .{ .q0 = clip(head), .q1 = clip(head) };
- const anchor = modal.offsetAt(text, cellOf(pane.vsel.row, pane.vsel.col));
+ const head = modal.offsetAt(text, cellOf(pane.body.cur_row, pane.body.cur_col));
+ if (!pane.body.vsel.active) return .{ .q0 = clip(head), .q1 = clip(head) };
+ const anchor = modal.offsetAt(text, cellOf(pane.body.vsel.row, pane.body.vsel.col));
var hi = @max(head, anchor);
if (hi < text.len) hi = modal.nextGrapheme(text, hi);
return .{ .q0 = clip(@min(head, anchor)), .q1 = clip(hi) };
@@ -137,23 +137,23 @@ pub fn setDot(pane: *Pane, r: State.Range) void {
const q0 = @min(@as(usize, r.q0), text.len);
const q1 = @max(q0, @min(@as(usize, r.q1), text.len));
const a = modal.positionAt(text, q0);
- pane.vsel = .{ .active = q1 > q0, .row = @intCast(a.row), .col = @intCast(a.col), .explicit = true };
+ pane.body.vsel = .{ .active = q1 > q0, .row = @intCast(a.row), .col = @intCast(a.col), .explicit = true };
const h = modal.positionAt(text, if (q1 > q0) modal.prevGrapheme(text, q1) else q0);
- pane.cur_row = @intCast(h.row);
- pane.cur_col = @intCast(h.col);
- pane.cur_pinned = true;
- pane.sticky_col = -1;
- pane.msel.active = false;
+ pane.body.cur_row = @intCast(h.row);
+ pane.body.cur_col = @intCast(h.col);
+ pane.body.cur_pinned = true;
+ pane.body.sticky_col = -1;
+ pane.body.msel.active = false;
pane.ensureCursorVisible();
}
pub fn showOffset(pane: *Pane, off: usize) void {
const text = bodyOf(pane);
const c = modal.positionAt(text, @min(off, text.len));
- pane.cur_row = @intCast(c.row);
- pane.cur_col = @intCast(c.col);
- pane.cur_pinned = true;
- pane.sticky_col = -1;
+ pane.body.cur_row = @intCast(c.row);
+ pane.body.cur_col = @intCast(c.col);
+ pane.body.cur_pinned = true;
+ pane.body.sticky_col = -1;
pane.ensureCursorVisible();
}