A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
Fix wheel scrolling in mouse-mode apps over mux: preserve notch count
RoversX6e7809f4a76e
diff --git a/wezterm-client/src/pane/mousestate.rs b/wezterm-client/src/pane/mousestate.rsindex 097a4ea9..f190bb89 100644--- a/wezterm-client/src/pane/mousestate.rs+++ b/wezterm-client/src/pane/mousestate.rs@@ -24,7 +24,19 @@ impl MouseState {}}- pub fn append(&mut self, event: MouseEvent) {+ pub fn append(&mut self, mut event: MouseEvent) {+ // The GUI passes through the raw OS wheel amount (lines per notch),+ // but a local terminal emits exactly one report per wheel event no+ // matter the amount. Normalize each event to a single notch so that+ // the coalescing below accumulates a notch count; the mux server+ // replays one report per notch, matching local behavior.+ event.button = match event.button {+ MouseButton::WheelUp(n) if n > 1 => MouseButton::WheelUp(1),+ MouseButton::WheelDown(n) if n > 1 => MouseButton::WheelDown(1),+ MouseButton::WheelLeft(n) if n > 1 => MouseButton::WheelLeft(1),+ MouseButton::WheelRight(n) if n > 1 => MouseButton::WheelRight(1),+ b => b,+ };if let Some(last) = self.queue.back_mut() {if last.modifiers == event.modifiers {if last.kind == MouseEventKind::Movediff --git a/wezterm-mux-server-impl/src/sessionhandler.rs b/wezterm-mux-server-impl/src/sessionhandler.rsindex 47615245..fe204b5f 100644--- a/wezterm-mux-server-impl/src/sessionhandler.rs+++ b/wezterm-mux-server-impl/src/sessionhandler.rs@@ -712,7 +712,29 @@ impl SessionHandler {let pane = mux.get_pane(pane_id).ok_or_else(|| anyhow!("no such pane {}", pane_id))?;- pane.mouse_event(event)?;+ // The client coalesces rapid wheel motion into a single+ // event with an accumulated amount, but the terminal+ // emits one report per event regardless of the amount;+ // replay it per notch so mouse-mode apps scroll the+ // full distance.+ use wezterm_term::MouseButton as MB;+ let notches = match event.button {+ MB::WheelUp(n) if n > 1 => Some((MB::WheelUp(1), n)),+ MB::WheelDown(n) if n > 1 => Some((MB::WheelDown(1), n)),+ MB::WheelLeft(n) if n > 1 => Some((MB::WheelLeft(1), n)),+ MB::WheelRight(n) if n > 1 => Some((MB::WheelRight(1), n)),+ _ => None,+ };+ match notches {+ Some((notch, n)) => {+ let mut single = event;+ single.button = notch;+ for _ in 0..n {+ pane.mouse_event(single.clone())?;+ }+ }+ None => pane.mouse_event(event)?,+ }maybe_push_pane_changes(&pane, sender, per_pane)?;Ok(Pdu::UnitResponse(UnitResponse {}))},