Improve SGR Scroll Wheel support

This commit is contained in:
Mattias Eriksson 2024-01-31 15:43:20 +01:00 committed by Jeremy Soller
parent 01b7b1c9d9
commit e91bf807ec
3 changed files with 78 additions and 12 deletions

View file

@ -1191,9 +1191,14 @@ where
}
}
Event::Mouse(MouseEvent::WheelScrolled { delta }) => {
if let Some(_p) = cursor_position.position_in(layout.bounds()) {
if let Some(p) = cursor_position.position_in(layout.bounds()) {
if is_mouse_mode {
terminal.scroll_mouse(delta);
let x = (p.x - layout.bounds().x) - self.padding.left;
let y = (p.y - layout.bounds().y) - self.padding.top;
//TODO: better calculation of position
let col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
terminal.scroll_mouse(delta, &state.modifiers, col as u32, row as u32);
} else {
match delta {
ScrollDelta::Lines { x: _, y } => {