# vim: Fix cgn backwards movement when there is no matches \(\#10237\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f9bf60f017c32e15d7996b32173c546d2027f80a

Requested commit: f9bf60f017c32e15d7996b32173c546d2027f80a

Commit: f9bf60f017c32e15d7996b32173c546d2027f80a

Tree: 2ff6d63a61b6af439e410fa1877fd9f40b8d1901

Author: joaquin30

Committer: GitHub

## Message

```
vim: Fix cgn backwards movement when there is no matches (#10237)

Release Notes:

- Fixed `cgn` backwards movement problem in #9982

There are two issues:

- When there are no more matches, the next repetition still moves the
cursor to the left. After that, the recording is cleared. For this I
simply move the cursor to the right, but it doesn't work when the cursor
is at the end of the line.
- If `cgn` is used when there are no matches, it cleans the previous
recorded actions. Maybe there should be a way to revert the recording.
This also happens when using `c` and `esc`

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
```

## Parents

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

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