Merge pull request #2864 from s-valent/main

Fix slow scroll in tui apps
This commit is contained in:
Mitchell Hashimoto
2024-12-01 12:30:12 -08:00
committed by GitHub

View File

@ -2336,7 +2336,7 @@ pub fn scrollCallback(
// If we're scrolling up or down, then send a mouse event. // If we're scrolling up or down, then send a mouse event.
if (self.io.terminal.flags.mouse_event != .none) { if (self.io.terminal.flags.mouse_event != .none) {
if (y.delta != 0) { for (0..@abs(y.delta)) |_| {
const pos = try self.rt_surface.getCursorPos(); const pos = try self.rt_surface.getCursorPos();
try self.mouseReport(switch (y.direction()) { try self.mouseReport(switch (y.direction()) {
.up_right => .four, .up_right => .four,
@ -2344,7 +2344,7 @@ pub fn scrollCallback(
}, .press, self.mouse.mods, pos); }, .press, self.mouse.mods, pos);
} }
if (x.delta != 0) { for (0..@abs(x.delta)) |_| {
const pos = try self.rt_surface.getCursorPos(); const pos = try self.rt_surface.getCursorPos();
try self.mouseReport(switch (x.direction()) { try self.mouseReport(switch (x.direction()) {
.up_right => .six, .up_right => .six,