Parker Loflin a3ce8d5e88 search: Replace from the editor while buffer search is open (#67470)
## Summary

`search::ReplaceNext` and `search::ReplaceAll` only work while focus is
in the buffer search bar. Bound in the `buffer_search_deployed` context,
they do nothing from the editor, unlike `search::SelectNextMatch`.

Both actions are now registered for the pane, like the other search
actions. Inside and outside the search bar, they run only while the
replace input is visible, so a hidden replacement can't overwrite
matches.

Workspace-level search actions now go to the focused pane instead of the
center pane, so search actions in the terminal panel no longer act on
the editor's search bar. `Workspace::focused_pane` now also finds zoomed
dock panels, which render outside their dock. The debug panel has no
`Panel::pane`, so its Terminal tab still sends them to the editor's
search bar, as on `main`.

With vim mode on, `vim::SearchSubmit` now propagates when the focused
pane has no vim editor or does not contain the focus, so `enter` selects
the next match in the search bars of the terminal panel and the
debugger's Terminal tab.

Closes #66518

## Testing

- To reproduce, bind `ctrl-r` to `search::ReplaceNext` in the
`buffer_search_deployed` context, open the search bar in replace mode,
fill in both fields, focus the editor, and press `ctrl-r`. Nothing
happens.
- Tested on Linux. On `main`, neither action changes the buffer. On this
branch, `search::ReplaceNext` replaces one match per press and
`search::ReplaceAll` replaces the rest.
- The test dispatches both actions from the editor, from the search bar
with the replace input hidden, and from a docked and a zoomed panel with
its own pane and a panel without one, then checks the buffer text and
the replace toggle.
- Each part of `test_replace_with_editor_focused` fails without its fix.
- `test_search_submit_without_vim_editor` presses `enter` in the search
bar of an editor without vim and checks that the next match is selected.
It fails without the fix.
- `test_search_submit_outside_pane` does the same in a search bar
outside the panes, with a vim editor in the center pane.
  It fails without the focus check.
- `cargo test -p search -p workspace -p file_finder -p terminal_view -p
vim --lib` and `./script/clippy -p search -p workspace -p vim` pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed `search::ReplaceNext` and `search::ReplaceAll` doing nothing
when the editor is focused while the buffer search bar is open, search
actions in the terminal panel acting on the editor's search bar, and
`enter` not selecting the next match in terminal search bars with Vim
mode on


https://github.com/user-attachments/assets/69be3dc7-9fb7-4c45-9aea-e6799db9725d

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-11-26 00:21:02 +00:00
2026-11-25 09:29:07 +00:00
…
2026-11-17 12:43:21 +00:00
…
2026-11-23 12:06:38 +00:00
…
…
…

Zed

Zed CI

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:

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

Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.

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 specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for 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 the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/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.

S
Description
No description provided
Readme 1.4 GiB
Languages
Rust 95.4%
JSON-with-Comments 2.4%
Python 0.8%
Inno Setup 0.3%
Tree-sitter Query 0.3%
Other 0.4%