mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-13 23:36:09 +03:00
core: do not scroll viewport if mouse reporting is requested
Fixes #570
This commit is contained in:
@ -1150,19 +1150,25 @@ pub fn scrollCallback(
|
|||||||
// or have alternate scroll disabled. In this case, we just run
|
// or have alternate scroll disabled. In this case, we just run
|
||||||
// the normal logic.
|
// the normal logic.
|
||||||
|
|
||||||
|
// If we're scrolling up or down, then send a mouse event.
|
||||||
|
if (self.io.terminal.flags.mouse_event != .none) {
|
||||||
|
if (y.delta != 0) {
|
||||||
|
const pos = try self.rt_surface.getCursorPos();
|
||||||
|
try self.mouseReport(if (y.delta < 0) .four else .five, .press, self.mouse.mods, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x.delta != 0) {
|
||||||
|
const pos = try self.rt_surface.getCursorPos();
|
||||||
|
try self.mouseReport(if (x.delta > 0) .six else .seven, .press, self.mouse.mods, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If mouse reporting is on, we do not want to scroll the
|
||||||
|
// viewport.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Modify our viewport, this requires a lock since it affects rendering
|
// Modify our viewport, this requires a lock since it affects rendering
|
||||||
try self.io.terminal.scrollViewport(.{ .delta = y.delta });
|
try self.io.terminal.scrollViewport(.{ .delta = y.delta });
|
||||||
|
|
||||||
// If we're scrolling up or down, then send a mouse event. This requires
|
|
||||||
// a lock since we read terminal state.
|
|
||||||
if (y.delta != 0) {
|
|
||||||
const pos = try self.rt_surface.getCursorPos();
|
|
||||||
try self.mouseReport(if (y.delta < 0) .four else .five, .press, self.mouse.mods, pos);
|
|
||||||
}
|
|
||||||
if (x.delta != 0) {
|
|
||||||
const pos = try self.rt_surface.getCursorPos();
|
|
||||||
try self.mouseReport(if (x.delta > 0) .six else .seven, .press, self.mouse.mods, pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try self.queueRender();
|
try self.queueRender();
|
||||||
|
Reference in New Issue
Block a user