[patch] Regression with patch 7.3.251

50 views
Skip to first unread message

Christian Brabandt

unread,
Jan 5, 2012, 4:15:47 AM1/5/12
to vim...@vim.org
Hi Bram,
I found another problem that was introduced with 7.3.251.

vim -u NONE -U NONE -N -i NONE -c "call setline('.',
['','foobar',''])|$"

Now the cursor is on the last line. Execute this command:
dv?bar

First, notice, that the buffer now looks like this:

-----
foo
-----

e.g. the first line was wrongly deleted. Now if you undo the previous
command (press u), you see this:

----
foo
foobar

----

So the undo did not work correctly.

I did a hg bisect to find the patch, that introduced this regression and
according to my testings, it was introduced with patch 7.3.251:

,----
| �nderung: 2957:fe6ad3fd8532
| Marke: v7-3-251
| Nutzer: Bram Moolenaar <br...@vim.org>
| Datum: Fri Jul 15 17:51:34 2011 +0200
| Dateien: src/normal.c src/ops.c src/version.c
| Beschreibung:
| updated for version 7.3.251
| Problem: "gH<Del>" deletes the current line, except when it's the last
| line.
| Solution: Set the "include" flag to indicate the last line is to be
| deleted.
`----

I am not sure if there are actually two problems (wrong undo and
wrongly joined lines) or if this is just the same problem. However, the
following patch fixes the wrongly joining lines for me and the wrong
undo does not occur anymore:

diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -1961,7 +1961,8 @@
/* Special case: gH<Del> deletes the last line. */
del_lines(1L, FALSE);
curwin->w_cursor = curpos; /* restore curwin->w_cursor */
- if (curwin->w_cursor.lnum > 1)
+ if (curwin->w_cursor.lnum > 1 &&
+ curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
--curwin->w_cursor.lnum;
}
else

regards,
Christian

Bram Moolenaar

unread,
Jan 5, 2012, 4:02:54 PM1/5/12
to Christian Brabandt, vim...@vim.org

Christian Brabandt wrote:

Thanks for finding out what is wrong and the suggested patch.
I'll check later if this is the best solution.

And to prevent further regressions a test would be nice.

--
Veni, Vidi, VW -- I came, I saw, I drove around in a little car.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jan 9, 2012, 2:55:52 PM1/9/12
to vim...@vim.org
Hi Bram!

Good idea. See attachment.

regards,
Christian

regression_251.diff

Bram Moolenaar

unread,
Jan 10, 2012, 7:44:40 AM1/10/12
to Christian Brabandt, vim...@vim.org

Christian Brabandt wrote:

> On Do, 05 Jan 2012, Bram Moolenaar wrote:
>
> >
> > Christian Brabandt wrote:
> >
> > > I found another problem that was introduced with 7.3.251.
> > >
> > > vim -u NONE -U NONE -N -i NONE -c "call setline('.',
> > > ['','foobar',''])|$"
> > >
> > > Now the cursor is on the last line. Execute this command:
> > > dv?bar
> > >
> > > First, notice, that the buffer now looks like this:
> > >
> > > -----
> > > foo
> > > -----
> > >
> > > e.g. the first line was wrongly deleted. Now if you undo the previous
> > > command (press u), you see this:
> > >
> > > ----
> > > foo
> > > foobar
> > >
> > > ----
> > >
> > > So the undo did not work correctly.
> > >
> > > I did a hg bisect to find the patch, that introduced this regression and
> > > according to my testings, it was introduced with patch 7.3.251:
> > >
> > > ,----

> > > | Änderung: 2957:fe6ad3fd8532

Thanks. I'll include this, but make a few small changes to (hopefully)
make it a bit more robust.

--
Men may not be seen publicly in any kind of strapless gown.
[real standing law in Florida, United States of America]

Reply all
Reply to author
Forward
0 new messages