Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/edit/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,9 @@ impl<'input> Stream<'_, '_, 'input> {
// I know there's an InputMouseState::Release, but that's because the internals of tui.rs
// have leaked into intput.rs. input.rs indicates release by the absence of buttons being
// held, which is InputMouseState::None. This makes it more reliable in my opinion.
} else if (WHEEL..WHEEL + 4).contains(&kind) {
let delta = if (kind & 1) != 0 { 3 } else { -3 };
let idx = if (kind & 2) != 0 { 0 } else { 1 };
} else if (WHEEL..WHEEL + 0x04).contains(&kind) {
let delta = if (btn & 0x01) != 0 { 1 } else { -1 };
let idx = if (btn & (0x02 | SHIFT)) != 0 { 0 } else { 1 };
mouse.scroll.as_array()[idx] += delta;
mouse.state = InputMouseState::Scroll;
} else if (kind & !MOTION) < 3 {
Expand Down
8 changes: 7 additions & 1 deletion crates/edit/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ impl Tui {
Some(Input::Mouse(mouse)) => {
let mut next_state = mouse.state;
let next_position = mouse.position;
let next_scroll = mouse.scroll;
let mut next_scroll = mouse.scroll;
let mouse_down = self.mouse_state == InputMouseState::None
&& next_state != InputMouseState::None;
let mouse_up = self.mouse_state != InputMouseState::None
Expand Down Expand Up @@ -621,6 +621,12 @@ impl Tui {

if is_scroll {
next_state = self.mouse_state;
next_scroll.x *= 7;
next_scroll.y *= 3;
if mouse.modifiers.contains(kbmod::ALT) {
next_scroll.x *= 5;
next_scroll.y *= 5;
}
} else if is_drag {
self.mouse_is_drag = true;
} else if mouse_down {
Expand Down