# vim: Fix n/N and \*/\# selecting text after cmd\+f search \(\#54027\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 068d64edd637be2e7e2a44b99ef4965550885b67

Requested commit: 068d64edd637be2e7e2a44b99ef4965550885b67

Commit: 068d64edd637be2e7e2a44b99ef4965550885b67

Tree: bb0913983153a5d7834fbc68749b5a0a13b8b321

Author: Liber

Committer: GitHub

## Message

```
vim: Fix n/N and */# selecting text after cmd+f search (#54027)

The cmd_f_search flag introduced in #51073 was never cleared when
switching to vim-style search commands, causing collapse_matches to
remain false and match ranges to appear as visual selections.

Reset cmd_f_search when n/N or */# are used, restore Normal mode if
Visual was entered due to the non-collapsed selection, and fix an early
return in visual select_match that leaked collapse_matches.

Fixes #53896

Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A or Added/Fixed/Improved ...

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
```

## Parents

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

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