On 9/8/06, Mark Manning <[EMAIL PROTECTED]> wrote:
I believe I may have found an obscure bug.  It is not a harmful bug.  It
does not make VIM crash or do weird things.  (Well, sort-of.)  :-)

Here is how to reproduce it:

First you have to have a lot of open and close braces ({{{{}}}}}).  They
do not have to be on the same line and in fact, this bug shows up better
if they are on separate lines.  For example:  This happened while I was
writing some Perl code and I had a lot of IF statements with their
trailing braces.  These were inside of a subroutine so the last line of
the subroutine is, of course a brace.  There were lots of subroutines
and I was cleaning up code by separating out the subroutines into
separate files.  So my code originally looked like this:

main
    .
    .
    .
sub a
{
    if(){
       if(){
       }
    }
}

sub b
{
    <more stuff>
    if(){
       if(){
       }
    }
}

and so on...

Ok.  So the problem happens when you delete "sub b" and then hit the
"dd" key to delete the blank line between "sub a"'s ending close brace
and where "sub b"'s starting line was.  When you do this VIM pops up
onto the end of the brace for "sub a".  The thing is, is that the cursor
isn't _on_ the close brace - it is next to the close brace.  So if you
then do a "%" VIM pops to the middle of the file rather than to the open
brace like it should do.  (ie: Match braces.)

Like I said - it's not a terrible problem, it doesn't crash VIM, it's
just a "what the heck!?" kind of thing and it took me a while to realize
that I was not doing something myself wrong and that it had more to do
with how VIM treated the deletion of the other line and where it put the
cursor afterwards.

However, this also brings up the next thing.  If, after deleting the
blank line you type the "$" key, the curse will pop to the correct
location (ie:on the close brace).  Does this mean that the cursor is
actually beyond the end of the line at that point?  Could this cause
other problems with VIM?

Anyway, just a short note.  Other than this, VIM works fine.  Here is my
system information:

Two separate versions of VIM are doing this.

Version #1 of VIM:
VIM v6.1
Windows XP Pro
512MB of memory
250GB hard drive (lots of space)
Editing standard text files.

Version #2 of VIM:
Vim v7.0.1
Cygwin via Windows XP Pro
Same system so same everything else.


I tried what you describe in vim7.0.91, and the cursor is
right on the closing brace after dd, not after.
Maybe you should upgdare to the latest vim7.

Yakov

Reply via email to