gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
388 stars 36 forks source link

Undo to one cursor, next added cursor uses previous match pattern #89

Closed duianto closed 5 years ago

duianto commented 5 years ago

Description

The previous matching pattern seems to be reused if the cursors are undone back to a single cursor with: gru (evil-mc-undo-last-added-cursor).

It works as expected if the additional cursors are undone from two or more cursors with: grq (evil-mc-undo-all-cursors).

Steps to reproduce

With the evil and evil-mc packages installed, and these lines added to init.el:

(require 'evil)
(evil-mode)

(require 'evil-mc)

two two


- Move the cursor to the beginning of the buffer: `gg`
- Add a second cursor: `C-n`
Two cursors appear at the end of both instances of the word `one` and the minibuffer shows:
>evil-mc There are 2 cursors matching "\_<one\_>"

- Undo the second cursor: `gru`
- Move to the third line (the first instance of the word: `two`)
- Try to create a second cursor based on the word `two`: `C-n`

### Observed

A cursor was added on the buffers first line (the first instance of the word `one`), and the minibuffer shows:
>evil-mc There are 2 cursors matching "\_<one\_>"

It's the same message as when the second cursor was created from the buffers first line (above).

![emacs_2019-03-18_19-32-50](https://user-images.githubusercontent.com/13420573/54555400-f2ecee00-49b6-11e9-8e5a-0b44780363ee.png)

### Expected

The second cursor should have been added to the second word `two`.

### System Info

Evil-mc-mode Version: 0.0.4
Evil version evil-git-4b195ddfc (Version: 1.2.14)
GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30
Windows 10 Version 1803