# terminal: Fix not able to select text during continuous output \(\#37395\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 6dcae2711dd7f7aa5813826dfc4aa416fee2abc9

Requested commit: 6dcae2711dd7f7aa5813826dfc4aa416fee2abc9

Commit: 6dcae2711dd7f7aa5813826dfc4aa416fee2abc9

Tree: 05aaf9b4d6cc2e0e66895f86773594df39704b7d

Author: Smit Barmase

Committer: GitHub

## Message

```
terminal: Fix not able to select text during continuous output (#37395)

Closes #37211

Regressed in https://github.com/zed-industries/zed/pull/33305

Every time the terminal updates, we emit
`SearchEvent::MatchesInvalidated` to trigger a re-run of the buffer
search, which calls `clear_matches` to drop stale results.
https://github.com/zed-industries/zed/pull/33305 PR also cleared the
selection when clearing matches, which caused this issue. We could fix
it by only clearing matches and selection when they’re non-empty, but
it’s better to not clear the selection at all. This matches how the
editor behaves and keeps it consistent. This PR reverts that part of
code.


Release Notes:

- Fixed an issue where text selection was lost during continuous
terminal output.
```

## Parents

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

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