Closes #18930 ### Summary - Fix fast Macbook trackpad/mouse scrolling in terminal applications with mouse mode enabled ### The Problem Scrolling with a trackpad in tmux, neovim, or any terminal app that enables mouse mode was too fast. A gentle swipe would send me through hundreds of lines, making these apps practically unusable in Zed's terminal. ### Root Cause When the terminal is in mouse mode, we send escape sequences to report scroll events to the application. The bug was in `scroll_report()`: https://github.com/zed-industries/zed/blob/3f8f7da2595116744439794fafacea6f570775db/crates/terminal/src/terminal.rs#L1983-L1988 That `max(scroll_lines, 1)` meant we'd send **at least 1 scroll event even when `scroll_lines` was 0**. https://github.com/zed-industries/zed/blob/3f8f7da2595116744439794fafacea6f570775db/crates/terminal/src/mappings/mouse.rs#L96 On macOS, trackpad gestures fire many small pixel deltas due to scroll acceleration. Each tiny movement triggered a scroll event, even though we hadn't accumulated enough pixels for a full line yet. This is a known issue alacritty/alacritty#2869 - macOS sends fractional line deltas (like 0.1) instead of whole lines. ### The Fix Don't send mouse reports when no full line has accumulated This aligns with Alacritty's approach - accumulate partial scroll amounts and only report when complete lines are ready. https://github.com/alacritty/alacritty/blob/6ee6e53ee3457c24137f117237b0ff1d84f6f836/alacritty/src/input/mod.rs#L700-L730 ### Testing Tested trackpad scrolling in: - tmux (pane navigation, scrollback) - neovim (buffer scrolling) - opencode (TUI navigation) All scroll smoothly now. ### Demo The demo shows the behavior of the scrolling. I can go fast or I can go slow https://github.com/user-attachments/assets/14bfc2f4-f286-4341-bf55-4ced894d63f9 Release Notes: - Fixed trackpad scrolling being too fast in terminal applications with mouse mode enabled (tmux, neovim, opencode, etc.)
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking issue)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.