summaryrefslogtreecommitdiff
path: root/core/mouse.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/mouse.zig')
-rw-r--r--core/mouse.zig14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/mouse.zig b/core/mouse.zig
index 2d731acf..14700995 100644
--- a/core/mouse.zig
+++ b/core/mouse.zig
@@ -702,7 +702,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
const id = hovered orelse return;
const pane = p.panes[id].?;
if (!programWheel(p, id, m, mcol, mrow))
- pane.scrollBy(if (m.button == .wheel_up) -config.wheel_rows else config.wheel_rows);
+ pane.scrollBy(p.settings.tab, if (m.button == .wheel_up) -config.wheel_rows else config.wheel_rows);
},
.wheel_left, .wheel_right => {
if (m.kind != .press) return;
@@ -779,7 +779,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
return pane.places.goTo(p.settings.tab, pane, i, false);
};
// gutter scrollbar: a left click scrolls UP to that row
- pane.scrollBy(-(@as(i32, mrow) - @as(i32, body_y)));
+ pane.scrollBy(p.settings.tab, -(@as(i32, mrow) - @as(i32, body_y)));
} else {
const on_tag = mrow >= tag_y and mrow < tag_y + pane.tag_rows;
if (on_tag and mcol < r.x + TAG_TEXT_INSET) return;
@@ -847,7 +847,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
if (mcol < r.x + config.GUTTER and !on_tag) {
const local = @as(i32, mrow) - @as(i32, body_y);
if (m.button == config.look_button) v.active = id;
- pane.scrollBy(if (m.button == config.look_button) local else -local);
+ pane.scrollBy(p.settings.tab, if (m.button == config.look_button) local else -local);
} else if (edit.pointerTextSelection(p, id, mcol, mrow, m.body_hit, v.pointer_tag_hit)) |pointed| {
if (m.button == config.look_button) v.active = id;
pane.clearPointerSelection(@backingInt(m.button));
@@ -1150,11 +1150,15 @@ pub fn edgeScroll(p: *Pardes) void {
const sl = &pane.sel[sel_slot];
if (s.anchor == null) s.anchor = sweepPoint(p, pane, sl.r0, sl.c0) orelse return;
const before = pane.scroll();
- pane.scrollBy(s.edge);
+ // A file's view moves by rows (File.Top), a terminal's rows are lines.
+ const moved: i64 = if (pane.file != null) panes.File.scrollRows(p.settings.tab, pane, s.edge) else blk: {
+ pane.scrollBy(p.settings.tab, s.edge);
+ break :blk pane.scroll() - before;
+ };
// The start's row follows its text while it is on the screen, and
// stays on the body's edge row once it is off (the anchor keeps it).
const top: i32 = pane.tag_rows;
- sl.r0 = std.math.clamp(sl.r0 - (pane.scroll() - before), top, top + @as(i32, pane.rows) - 1);
+ sl.r0 = std.math.clamp(sl.r0 - @as(i32, @intCast(moved)), top, top + @as(i32, pane.rows) - 1);
}
/// The text position under a body cell of the sweep's space.