848d3cc34e64658463b112397e8ae656ac4d7100
## Summary Fixes #44812 The hover highlight for clickable inlay hints was not covering the last character when the label contained multi-byte UTF-8 characters (e.g., `→`). ## Problem When hovering over an inlay hint like `→ app/Livewire/UserProfile.php`, the highlight/underline stopped one character short, leaving the final character unhighlighted. **Root cause:** `find_hovered_hint_part()` in `hover_popover.rs` used `part.value.chars().count()` (character count) but `InlayOffset` wraps `MultiBufferOffset(pub usize)` which is byte-based. For a label like `→ app/Livewire/UserProfile.php`: - Byte length: 32 (the `→` character is 3 bytes in UTF-8) - Character count: 30 This mismatch caused the calculated highlight range to end 2 bytes short. ## Changes 1. **Use byte length instead of character count** (line 112): ```rust // Before (buggy) let part_len = part.value.chars().count(); // After (correct) let part_len = part.value.len(); ``` 2. **Fix boundary condition** (line 113): Changed `>` to `>=` for correct `[start, end)` range semantics when hovering at part boundaries. 3. **Rename variable** for clarity: `hovered_character` → `offset_in_hint` since it's a byte offset, not a character position. 4. **Add unit test** reproducing the exact scenario from the issue with multi-byte UTF-8 characters. ## Testing Added `test_find_hovered_hint_part_with_multibyte_characters` which: - Verifies the label `→ app/Livewire/UserProfile.php` has 32 bytes but 30 characters - Tests hovering at the last byte correctly returns the full range - Tests boundary behavior with multiple label parts containing multi-byte characters Release Notes: - Fixed inlay hint hover highlight not covering the last character when the label contains multi-byte UTF-8 characters
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.
Languages
Rust
94.9%
JSON-with-Comments
2.7%
Python
0.8%
Inno Setup
0.3%
Tree-sitter Query
0.3%
Other
0.5%