* How to end text-insert undo segment after cursor jump (caused by mouse)?
@ 2020-10-17 17:35 David
2020-10-17 22:34 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: David @ 2020-10-17 17:35 UTC (permalink / raw)
To: help-gnu-emacs
Hello
How to end text-insert undo segment after cursor jump (caused by mouse)?
Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated
that undo segment is not ended when a mouse-caused cursor movement
occurs. An example : While I am inserting text, touchpad gets often
touched, causing the cursor to jump elsewhere. If I have entered five
sentences just where I wanted them, without any jump, but sixth sentence
gets by mistake entered all over the place because of multiple (three)
touchpad touches in different places, when I notice this, I need to be
able to execute (three times) "undo" so that the fives sentences stay
intact, and the undo operation erase only the sixth sentence from all
over the place.
Right now when insert gets this way screwed up, the undo tree contains
only one segment. When I press undo, all six sentences disappear. I have
to choose all-or-nothing, neither of which is very useful!!
Appending after "blabla" by entering insert mode and typing "This is
first sentence. " /now mouse click occurs by mistake/ "This is second
sentence." I get: blabla This is This is second sentence. first
sentence. Pressing U for undo I need to get : blabla This is first
sentence. , but I am instead getting: blabla
Interestingly enough, when text is being replaced and not inserted,
everything works as expected - undo segment ends when mouse moves the
cursor, so replacing by mistake I can in sequence undo the previous
changes made after mouse-caused jump.
How can I fix this? Is it a bug, or some funny feature?
Yours sincerely
David
PS: Please do not advise me to get "disable touch pad while typing"
working.
^ permalink raw reply [flat|nested] 4+ messages in thread
* How to end text-insert undo segment after cursor jump (caused by mouse)?
@ 2020-10-17 18:44 David
2020-10-17 18:50 ` Gregory Heytings via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 4+ messages in thread
From: David @ 2020-10-17 18:44 UTC (permalink / raw)
To: help-gnu-emacs, help-gnu-emacs
Hello
How to end text-insert undo segment after cursor jump (caused by mouse)?
Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated
that undo segment is not ended when a mouse-caused cursor movement
occurs. An example : While I am inserting text, touchpad gets often
touched, causing the cursor to jump elsewhere. If I have entered five
sentences just where I wanted them, without any jump, but sixth sentence
gets by mistake entered all over the place because of multiple (three)
touchpad touches in different places, when I notice this, I need to be
able to execute (three times) "undo" so that the fives sentences stay
intact, and the undo operation erase only the sixth sentence from all
over the place.
Right now when insert gets this way screwed up, the undo tree contains
only one segment. When I press undo, all six sentences disappear. I have
to choose all-or-nothing, neither of which is very useful!!
Appending after "blabla" by entering insert mode and typing "This is
first sentence. " /now mouse click occurs by mistake/ "This is second
sentence." I get: blabla This is This is second sentence. first
sentence. Pressing U for undo I need to get : blabla This is first
sentence. , but I am instead getting: blabla
Interestingly enough, when text is being replaced and not inserted,
everything works as expected - undo segment ends when mouse moves the
cursor, so replacing by mistake I can in sequence undo the previous
changes made after mouse-caused jump.
How can I fix this? Is it a bug, or some funny feature?
Yours sincerely
David
PS: Please do not advise me to get "disable touch pad while typing"
working.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to end text-insert undo segment after cursor jump (caused by mouse)?
2020-10-17 18:44 How to end text-insert undo segment after cursor jump (caused by mouse)? David
@ 2020-10-17 18:50 ` Gregory Heytings via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 4+ messages in thread
From: Gregory Heytings via Users list for the GNU Emacs text editor @ 2020-10-17 18:50 UTC (permalink / raw)
To: David; +Cc: help-gnu-emacs
>
> How to end text-insert undo segment after cursor jump (caused by mouse)?
>
> Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated
> that undo segment is not ended when a mouse-caused cursor movement
> occurs.
>
[...]
>
> PS: Please do not advise me to get "disable touch pad while typing"
> working.
>
I'd suggest you to use (mouse-avoidance-mode 'banish). It's built-in
since Emacs 21.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to end text-insert undo segment after cursor jump (caused by mouse)?
2020-10-17 17:35 David
@ 2020-10-17 22:34 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2020-10-17 22:34 UTC (permalink / raw)
To: help-gnu-emacs
> How to end text-insert undo segment after cursor jump (caused by mouse)?
Note that the behavior you describe comes from code in Evil. The way
undo steps are divided in non-Evil Emacs is different (mostly, finer
grained).
More specifically, I believe that if you perform the `undo` *before* you
finish your insertion (i.e. before hitting ESC), you should get (more or
less) the behavior you want, i.e. the cursor jump due to your mouse
event will indeed have ended an undo sequence. Evil then collapses
those undo steps into a single one when you leave insertion mode.
In any case, maybe setting `evil-want-fine-undo` will also do the trick.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-17 22:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-17 18:44 How to end text-insert undo segment after cursor jump (caused by mouse)? David
2020-10-17 18:50 ` Gregory Heytings via Users list for the GNU Emacs text editor
-- strict thread matches above, loose matches on Subject: below --
2020-10-17 17:35 David
2020-10-17 22:34 ` Stefan Monnier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).