Search is highly generic, editor is the only implementation that has a concept of a cursor. When the cursor moves eventually `Editor::selections_did_change` runs which among a bunch of things triggers the `SearchEvent::ActiveMatchChanged`. This was handled by the `BufferSearchBar` by moving the currently highlighted item. When going to the next search result (from the cursor position) we call `BufferSearchBar::match_index_for_direction`. It relied on the current_index being updated during the handling of `ActiveMatchChanged` which we removed. It now instead figures out the next/prev search result from the users cursor in the buffer directly. The `SearchEvent::ActiveMatchChanged` was being used for different responsibilities in different places in the codebase where it was emmited, namely: * On the `editor::Editor::selections_did_change` it was being emmited in case a single selection (single cursor) existed, and this was the thing reponsible for indirectly updating the active match as soon as the cursor moved out of match. * On the `terminal` side, it's being emitted when the user clicks on the terminal, to "simulate" what the cursor position would be and update the active match to the next closes match compared to the click position. * On the `markdown_preview` side it was being emmited whenever the active match was updated but, from testing, it does actually seem to not drive anything and is unnecessary? Given that we no longer want to update the active match in the buffer everytime the user moves the cursor, we removed the event emission from `editor::Editor::selections_did_change` as well as removing the one from `markdown_preview`, as it seems it doesn't have any noticeable impact. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] 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 Closes #44367 Release Notes: - Fixed search highlighting changing anytime the cursor moves. --------- Co-authored-by: Yara <git@yara.blue>
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.