1ec466b72851c95ac20e868daa60a19e0464154e
As discussed and explained in https://github.com/zed-industries/zed/pull/26893#discussion_r2074102719 This PR fixes an issue where we would have zero-divisions during scrollbar layouting for small files. This happened due to the fact that for small files, https://github.com/zed-industries/zed/blob/9c1b2afa492755a1e8cb0a77f929845941c97cdc/crates/editor/src/element.rs#L8562-L8563 would be `NaN`, since `(total_text_units - text_units_per_page).max(0.)` would return `0.`, which we would divide by. However, this was neccessary to be in place, as this prevented the scroll thumb from being rendered for small files: Due to this being `NaN`, the thumb origin would be `Pixels(NaN)`, which prevented the rendering of the scrollbar thumb. This PR fixes this behavior by accounting for this scenario and changing the thumb bounds to be an `Option<Bounds<Pixels>>` instead. This furthermore has the advantage that we have to compute the thumb only once and storing it in the layout, which was previously not possible. Most notably, this enables scrollbar markers to show for smaller files: https://github.com/user-attachments/assets/9fa5d240-8795-4fae-9933-aed144df4f5e Currently, no markers are shown due to the fact that `Pixels(NaN)` is set as the origin point. Also, I changed that the cursor style will only be changed on the scrollbar hitbox when we will actually show a thumb. This way, for small files (where viewport > content size) the cursor will not change when a user hovers with their mouse over the scrollbars hitbox. Theoretically, I could also include the change mentioned in https://github.com/zed-industries/zed/pull/26893#discussion_r2076316956 here. Given the introduction of the minimap as well as #29316 and the cursor style taken care of here, removing the guard would not change anything and creates the possibility to soon introduce scrollbars for auto height editors. Please let me know whether we want to have this in this PR or whether I shall create a seperate one. Release Notes: - Enabled scrollbar marker rendering for small files.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS and Linux you can download Zed directly or install Zed via your local package manager.
Other platforms are not yet available:
- Windows (tracking issue)
- Web (tracking issue)
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
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.
Description
GPUI – Community Edition maintained by Oak Team
https://gpui-ce.github.io/
258 MiB
Languages
Rust
95.6%
WGSL
1.2%
Metal
1.1%
HLSL
1.1%
Python
0.6%
Other
0.3%