# buffer_search: Fix replace buttons not working if search bar is not focused \(\#43569\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ab96155d6a968e73f1368a5af45888e70796aab2)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ab96155d6a968e73f1368a5af45888e70796aab2

Requested commit: ab96155d6a968e73f1368a5af45888e70796aab2

Commit: ab96155d6a968e73f1368a5af45888e70796aab2

Tree: 08ce62be25e4204707d4e79445eeb40debd6825c

Author: Dino

Committer: GitHub

## Message

```
buffer_search: Fix replace buttons not working if search bar is not focused (#43569)

Update the way that both
`search::buffer_search::BufferSearchBar.replace_next` and
`search::buffer_search::BufferSearchBar.replace_all` are registered as
listeners, so that we don't require the replacement editor to be focused
in order for these listeners to be active, only requiring the
replacement mode to be active in the buffer search bar.

This means that, even if the user is focused on the buffer editor, if
the "Replace Next Match" or "Replace All Matches" buttons are clicked,
the replacement will be performed.

Closes #42471 

Release Notes:

- Fixed issue with buffer search bar where the replacement buttons
("Replace Next Match" & "Replace All Matches") wouldn't work if search
bar was not focused
```

## Parents

- [8e04706c4d2b5ef454e1c1ffb9d5aac72118b55d](https://git.cafe/gitcafe/zed/commit/8e04706c4d2b5ef454e1c1ffb9d5aac72118b55d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ab96155d6a968e73f1368a5af45888e70796aab2?format=markdown)
