editor: Fix movement mismatch between minimap thumb and cursor (#62087)
# Objective
Fixes #44824
This bug results from an incorrect mathematical derivation of the
`pixels_per_line` calculation formula. The complete derivation is too
lengthy to include here, so it is provided in a separate comment below.
This PR does the same thing as #60080, but it is a refined version of
it.
## Solution
Replace the previous incorrect calculation formula with the correct one.
## Testing
These changes are manually tested on my computer and all worked as
expected.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
## Showcase
This recording shows the behavior in short document environment:
https://github.com/user-attachments/assets/2e5e7aec-ccf2-47c3-a046-e7f668bdb6c0
While this one shows the behavior in long document environment:
https://github.com/user-attachments/assets/e5809c81-4cfb-45f9-8ec7-051a487bd6f7
It's apparent that the minimap thumb moves closely with the cursor in
both environments.
---
Release Notes:
- Fixed movement mismatch between minimap thumb and cursor.
---------
Co-authored-by: Finn Evers <finn@zed.dev>
90731bdec0Yue Fei committed on 10/2/2026, 10:08:12 AM· committed by GitHubparent6708a25