Improve wheel mode
This commit is contained in:
parent
f52df3d89e
commit
f570b4089c
1 changed files with 39 additions and 26 deletions
|
|
@ -43,7 +43,10 @@ use std::{
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{key_bind::key_binds, terminal::Metadata, Action, Terminal, TerminalScroll};
|
use crate::{
|
||||||
|
key_bind::key_binds, mouse_reporter::MouseReporter, terminal::Metadata, Action, Terminal,
|
||||||
|
TerminalScroll,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct TerminalBox<'a, Message> {
|
pub struct TerminalBox<'a, Message> {
|
||||||
terminal: &'a Mutex<Terminal>,
|
terminal: &'a Mutex<Terminal>,
|
||||||
|
|
@ -1194,6 +1197,15 @@ where
|
||||||
let col = x / terminal.size().cell_width;
|
let col = x / terminal.size().cell_width;
|
||||||
let row = y / terminal.size().cell_height;
|
let row = y / terminal.size().cell_height;
|
||||||
terminal.scroll_mouse(delta, &state.modifiers, col as u32, row as u32);
|
terminal.scroll_mouse(delta, &state.modifiers, col as u32, row as u32);
|
||||||
|
} else {
|
||||||
|
if terminal.term.lock().mode().contains(TermMode::ALT_SCREEN) {
|
||||||
|
MouseReporter::report_mouse_wheel_as_arrows(
|
||||||
|
&terminal,
|
||||||
|
terminal.size().cell_width,
|
||||||
|
terminal.size().cell_height,
|
||||||
|
delta,
|
||||||
|
);
|
||||||
|
status = Status::Captured;
|
||||||
} else {
|
} else {
|
||||||
match delta {
|
match delta {
|
||||||
ScrollDelta::Lines { x: _, y } => {
|
ScrollDelta::Lines { x: _, y } => {
|
||||||
|
|
@ -1225,6 +1237,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
let x = p.x - self.padding.left;
|
let x = p.x - self.padding.left;
|
||||||
let y = p.y - self.padding.top;
|
let y = p.y - self.padding.top;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue