chore: clippy
This commit is contained in:
parent
900dd88a70
commit
d20dbadd02
2 changed files with 35 additions and 37 deletions
|
|
@ -224,8 +224,8 @@ impl MouseReporter {
|
||||||
};
|
};
|
||||||
|
|
||||||
//Generate term codes
|
//Generate term codes
|
||||||
let x_iter = std::iter::repeat(button_no_x).take(lines_x.unsigned_abs() as _);
|
let x_iter = std::iter::repeat_n(button_no_x, lines_x.unsigned_abs() as _);
|
||||||
let y_iter = std::iter::repeat(button_no_y).take(lines_y.unsigned_abs() as _);
|
let y_iter = std::iter::repeat_n(button_no_y, lines_y.unsigned_abs() as _);
|
||||||
|
|
||||||
x_iter
|
x_iter
|
||||||
.chain(y_iter)
|
.chain(y_iter)
|
||||||
|
|
|
||||||
|
|
@ -1260,44 +1260,42 @@ 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 {
|
||||||
if terminal.term.lock().mode().contains(TermMode::ALT_SCREEN) {
|
match delta {
|
||||||
MouseReporter::report_mouse_wheel_as_arrows(
|
ScrollDelta::Lines { x: _, y } => {
|
||||||
&terminal,
|
//TODO: this adjustment is just a guess!
|
||||||
terminal.size().cell_width,
|
state.scroll_pixels = 0.0;
|
||||||
terminal.size().cell_height,
|
let lines = (-y * 6.0) as i32;
|
||||||
delta,
|
if lines != 0 {
|
||||||
);
|
terminal.scroll(TerminalScroll::Delta(-lines));
|
||||||
status = Status::Captured;
|
|
||||||
} else {
|
|
||||||
match delta {
|
|
||||||
ScrollDelta::Lines { x: _, y } => {
|
|
||||||
//TODO: this adjustment is just a guess!
|
|
||||||
state.scroll_pixels = 0.0;
|
|
||||||
let lines = (-y * 6.0) as i32;
|
|
||||||
if lines != 0 {
|
|
||||||
terminal.scroll(TerminalScroll::Delta(-lines));
|
|
||||||
}
|
|
||||||
status = Status::Captured;
|
|
||||||
}
|
}
|
||||||
ScrollDelta::Pixels { x: _, y } => {
|
status = Status::Captured;
|
||||||
//TODO: this adjustment is just a guess!
|
}
|
||||||
state.scroll_pixels -= y * 6.0;
|
ScrollDelta::Pixels { x: _, y } => {
|
||||||
let mut lines = 0;
|
//TODO: this adjustment is just a guess!
|
||||||
let metrics = terminal.with_buffer(|buffer| buffer.metrics());
|
state.scroll_pixels -= y * 6.0;
|
||||||
while state.scroll_pixels <= -metrics.line_height {
|
let mut lines = 0;
|
||||||
lines -= 1;
|
let metrics = terminal.with_buffer(|buffer| buffer.metrics());
|
||||||
state.scroll_pixels += metrics.line_height;
|
while state.scroll_pixels <= -metrics.line_height {
|
||||||
}
|
lines -= 1;
|
||||||
while state.scroll_pixels >= metrics.line_height {
|
state.scroll_pixels += metrics.line_height;
|
||||||
lines += 1;
|
|
||||||
state.scroll_pixels -= metrics.line_height;
|
|
||||||
}
|
|
||||||
if lines != 0 {
|
|
||||||
terminal.scroll(TerminalScroll::Delta(-lines));
|
|
||||||
}
|
|
||||||
status = Status::Captured;
|
|
||||||
}
|
}
|
||||||
|
while state.scroll_pixels >= metrics.line_height {
|
||||||
|
lines += 1;
|
||||||
|
state.scroll_pixels -= metrics.line_height;
|
||||||
|
}
|
||||||
|
if lines != 0 {
|
||||||
|
terminal.scroll(TerminalScroll::Delta(-lines));
|
||||||
|
}
|
||||||
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue