gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
383 stars 35 forks source link

`evil-paste-pop` with multi cursors breaks undo history #91

Open duianto opened 5 years ago

duianto commented 5 years ago

Description

evil-paste-pop (keybinding: M-y) isn't supported by evil-mc as described by the error message:

evil-mc Failed to execute evil-paste-pop with error: evil-paste-pop is not supported

But when M-y is pressed with multiple evil-mc cursors, then it can causes three different undo issues.

1

All (at least any recently) typed characters are undone when u is pressed, instead of each undo stopping where the cursor had exited to normal state.

2

Or either of these two messages can appear when u is pressed:

primitive-undo: Unrecognized entry in undo list undo-tree-canary

3

primitive-undo: Changes to be undone are outside visible portion of buffer

At least with 2 and 3, there's no past undo history, which will lead to lost work.

Steps to reproduce

Setup:

With the evil and evil-mc packages installed and loaded:

(require 'evil)
(evil-mode)
(require 'evil-mc)
  1. Open a new buffer: C-x b test RET
  2. Enable evil-mc-mode: M-x evil-mc-mode RET
  3. Type: a
  4. Exit to normal state: ESC
  5. Enter insert state on a newline below: o
  6. Type: b
  7. Exit to normal state: ESC
  8. Enter insert state on a newline below: o
  9. Type: c
  10. Exit to normal state: ESC
  11. Copy the line: yy (so that the kill-ring at least contains one item)

Issue 1:

All three typed letters a, b and c were undone. Before pressing M-y, the typed letters were undone one at a time.

Issue 2:

This message appears:

primitive-undo: Changes to be undone are outside visible portion of buffer

Issue 3:

And there's no previous undo history.

Expected

Since the evil-paste-pop command isn't supported, then it's fine that an error message is shown.

But the undo history should not break.

System Info

evil-mc-20190321.1606 evil-20190222.1212

In both: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30 Windows 10 Version 1803

And GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-02-28 Ubuntu 18.04.2 (as a virtualbox guest with Win 10 as host)

gabesoft commented 5 years ago

Thanks @duianto, I'll take a look when I get a chance.