Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change motion adds one letter on the active cursor #63

Open
dchrzanowski opened this issue May 13, 2017 · 9 comments
Open

Change motion adds one letter on the active cursor #63

dchrzanowski opened this issue May 13, 2017 · 9 comments

Comments

@dchrzanowski
Copy link

Let it be that I have 4 cursors active as follows:

set[q]
set[q]
set[q]
set[q] <- active cursor

After running cb I get:
[]
[]
[]
[q]

The q gets left behind on the active cursor. This behavior occurs about 99% of the time, sometimes it just works, most of the time it fails. It is the same case with other motions: e, E, b, B, w, W, f, F, t, T. However, any command, be it: change,delete or even surround command work absolutely perfectly when used from visual state.

Is this a problem for anyone else?
Apart from this little issue the package is excellent!

@gabesoft
Copy link
Owner

gabesoft commented May 14, 2017

I wasn't able to reproduce this issue. I've added more tests that cover this scenario though in this commit 93ba565. I wonder if there's some interference from other plugin or maybe it's your Emacs version (the tests run against 25.1). In your example it seems that the fake cursors are misbehaving by removing the entire word. The real cursor has the correct behavior.

@dchrzanowski
Copy link
Author

I am using the same version of Emacs 25.1 . I do wonder why is this happening. Realistically if I want it to do, what it needs to do, reliably, I need to use the visual state.

I'll try to switch off some other packages. Rerun the tests on Win as well. I'll get back to you asap.

@gabesoft
Copy link
Owner

Also, do you get any errors in the messages buffer?

@gabesoft
Copy link
Owner

Oh, so you're on Windows. That could be the reason. Let me know how the tests behave there.

@dchrzanowski
Copy link
Author

I'll check the error messages. I am on Arch Linux, but I have the same Emacs setup on Win 7,which I haven't checked for this problem. I'll try to run the tests tonight, otherwise it'll have to be tomorrow then.

@dchrzanowski
Copy link
Author

Ok! It seems that I have found the problem. I use (setq evil-move-cursor-back nil) as I don't like the cursor going back after exiting insert mode. Changing the variable to t removed the problem, now all the cursors behave the same way. However, I prefer the original cursor behaviour. Would there be a way of fixing this somehow? Or a small workaround perhaps?

@gabesoft
Copy link
Owner

Oh, I see. Interesting. I'm not sure if there's an easy way to fix that. I'll think about it.

@dchrzanowski
Copy link
Author

That's great! Thanks!

I just thought that there must a bit of code that makes the "clone cursors" enter and exit the insert state at the beginning of the change motion, this might be the cause of the disturbance. Just food for thought. I would love to help, but my knowledge of elisp is very basic :-(

@dchrzanowski
Copy link
Author

dchrzanowski commented May 15, 2017

I thought that I do not mind the standard evil behaviour while the multiple cursors are active, so I thought of just switching the evil-move-cursor-back variable to t while the cursors are active and toggle it back to nil when the cursors are deleted, thus this solves the problem for me:

(add-hook 'evil-mc-before-cursors-created (lambda () (setq-default evil-move-cursor-back t)))

(add-hook 'evil-mc-after-cursors-deleted (lambda () (setq-default evil-move-cursor-back nil)))

EDIT:
changed setq to setq-default, makes the change persistent across buffers when leaving helm-multi-swoop-edit or helm-ag-edit buffers

@dchrzanowski dchrzanowski changed the title Change motion skips one letter in non active cursors Change motion adds one letter on the active cursors May 15, 2017
@dchrzanowski dchrzanowski changed the title Change motion adds one letter on the active cursors Change motion adds one letter on the active cursor May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants