terminal: Fix not able to select text during continuous output (#37395)
Smit Barmase
created
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.