skypacer210 / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Pressing <C-R> continuously to redo changes inserts <12> character after a few redo #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
======================================
1. Open a file with many changes (I use persistent undo so I have files with 
thousands of changes for more than a year ago)
2. In normal mode, press the the 'u' key _continuously_ (for several second, 
say 10 seconds). This performs undo of many changes, hundreds of them or so for 
example.
3. Now keep pressing the <C-R> _continuously_ for several seconds to redo those 
change.

What is the expected output?
============================
I would expect that pressing <C-R> should redo all the changes to go back to 
the most recent change in the undo active branch.

What do you see instead?
========================
Instead, pressing <C-R> continuously only redo a few changes, and then after a 
few seconds, it inserts the <12> character (i.e. ^R) in the file, creating a 
new branch in the undo tree.  It does not redo till the most recent change in 
the undo tree.

It's reproducible all the time, but how long it takes to happens is variable: 
sometimes it happens after pressing <C-R> for just 2 seconds, sometimes I need 
to press <C-R> for 8 second, sometimes 5 seconds...

What version of the product are you using? On what operating system?
====================================================================
I'm using Vim-7.3.470 in GNOME terminal on Linux x86.

Additional remarks
==================
Instead of pressing 'u' and <C-R> on the keyboard continuously, I also tried to 
reproduce it with...

:call feedkeys(repeat('u', 1000), 'n')
:call feedkeys(repeat("\<C-R>", 500), 'n')

But when doing this, it works fine all the time (even though it should be 
equivalent I think).

It's reproducible with the minimalistic .vimrc:

set nocompatible
set undolevels=4000
set undodir=~/UNDODIR
set undofile

Original issue reported on code.google.com by dominiqu...@gmail.com on 7 Mar 2012 at 10:58

GoogleCodeExporter commented 9 years ago
Here is a simpler way to reproduce the bug:

1) start vim with:  vim -u NONE

2) Enter following Ex command which creates 1000 edits and then it does undo of 
all of them:

:set nocp undolevels=2000|call feedkeys('A'.repeat("*\<C-g>u", 
1000)."\<Esc>1000u", 'n')

3) Then press <C-R> (keep pressing the key for several seconds). This should 
redo all the changes one by one (displaying a bunch of * characters).

What I observe instead, is something like this when pressing <C-R>

*************************^R

I.e. the ^R character (<12>) is inserted after pressing <C-R> for several 
seconds.

I also noticed that I could not reproduce it on a Linux x86_64 desktop but I 
can reproduce it all the time on a Linux x86 laptop.

I then tried to reproduce it by starting Vim as follows to save all commands in 
a file "save-cmds":

$ vim -u NONE -W save-cmds

Then I reproduced the bug with steps 2) and 3).

The created "save-cmds" file contains this:

:<80>ku:set nocp undolevels=2000|call feedkeys('A'.repeat("*\<C-g>u", 
1000)."\<Esc>1000u", 
'n')^M^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R
^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^R^Rr^R^R^RESC:qa!

Notice the 'r' command near the end of the file which should not be there! (it 
should be ^R)

So I'm starting the think that the problem is with my keyboard. It behaves as 
if I unpressed temporarily the control key while while pressing <C-R> 
continuously (hence entering a r command in Vim which then inserts ^R instead 
of doing undo).

Original comment by dominiqu...@gmail.com on 8 Mar 2012 at 6:57

GoogleCodeExporter commented 9 years ago
I cannot reproduce it.
Did you try using another terminal?

Original comment by br...@google.com on 8 Mar 2012 at 9:09

GoogleCodeExporter commented 9 years ago
> Did you try using another terminal?

I just tried.  It happens in gnome-terminal and xterm.
It also happens in gvim (gtk2).

I then started the "gedit" text editor and pressed CTRL-R continuously,
I can see once in a while the r letter appearing every few seconds,
irregularly in gedit.

So it is not a bug in Vim after all but a problem with my keyboard most
certainly, which behaves as if CTRL key becomes unpressed for a short time.

There are 2 CTRL keys on the keyboard. The other CTRL key has the same problem
which I find puzzling.

Anyway, let's close this issue as not a bug in Vim.

Original comment by dominiqu...@gmail.com on 8 Mar 2012 at 9:26

GoogleCodeExporter commented 9 years ago
I like the conclusion of this bug!

Original comment by brammool...@gmail.com on 9 Mar 2012 at 11:04