## Context When using regex buffer search (e.g. `^something`), Zed correctly navigates only to actual matches. However, navigating to a match selects the matched text, which triggers the **selection occurrence highlight** feature. That feature performs a *plain literal* search for the selected word and highlights all occurrences, including ones that don't satisfy the regex. The user would see a 4th mid-line occurrence highlighted, even though `^something` never matched it, this behavior is quite confusing. The fix tracks whether the current selection was set by search navigation via a new `from_search: bool` on `SelectionEffects`. When `last_selection_from_search` is set and `BufferSearchHighlights` are active, selection occurrence highlights are suppressed. Making a manual text selection during an active search clears the flag, restoring normal occurrence-highlight behavior. The behavior now matches how VSCode handles this case. The video below demonstrates the behavior after the fix and shows that it matches the VSCode behavior now [Screencast from 2026-03-28 01-33-46.webm](https://github.com/user-attachments/assets/07a005b8-53b1-4abf-93d2-96406f0b6a11) Closes #52589 ## How to Review Three files changed — read in this order: 1. **`crates/editor/src/editor.rs`** Adds `from_search: bool` to `SelectionEffects` (with a builder method) and `last_selection_from_search: bool` to `Editor`. `selections_did_change()` records the flag from effects. `prepare_highlight_query_from_selection()` returns `None` early when both `last_selection_from_search` and active `BufferSearchHighlights` are set. 2. **`crates/editor/src/items.rs`** `activate_match()` now calls `.from_search(true)` on its `SelectionEffects` so search-driven selections are marked at the source. 3. **`crates/search/src/buffer_search.rs`** Regression test `test_regex_search_does_not_highlight_non_matching_occurrences`: verifies that after search navigation, `SelectedTextHighlight` is suppressed and exactly 3 `BufferSearchHighlights` exist; and that after a manual selection, `SelectedTextHighlight` is restored. ## 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 is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed regex buffer search highlighting non-matching word occurrences via the selection occurrence highlight feature |
||
|---|---|---|
| .cargo | ||
| .cloudflare | ||
| .config | ||
| .factory | ||
| .github | ||
| .zed | ||
| assets | ||
| ci | ||
| crates | ||
| docs | ||
| extensions | ||
| legal | ||
| nix | ||
| script | ||
| tooling | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .handoff-introduce-thread-id.md | ||
| .mailmap | ||
| .prettierrc | ||
| .rules | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| clippy.toml | ||
| CODE_OF_CONDUCT.md | ||
| compose.yml | ||
| CONTRIBUTING.md | ||
| debug.plist | ||
| default.nix | ||
| Dockerfile-collab | ||
| Dockerfile-collab.dockerignore | ||
| Dockerfile-cross.dockerignore | ||
| Dockerfile-distros | ||
| Dockerfile-distros.dockerignore | ||
| flake.lock | ||
| flake.nix | ||
| GEMINI.md | ||
| LICENSE-AGPL | ||
| LICENSE-APACHE | ||
| LICENSE-GPL | ||
| livekit.yaml | ||
| lychee.toml | ||
| Procfile | ||
| Procfile.all | ||
| Procfile.web | ||
| README.md | ||
| renovate.json | ||
| REVIEWERS.conl | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
| shell.nix | ||
| typos.toml | ||
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.