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
> > > | Marke: v7-3-251
> > > | Nutzer: Bram Moolenaar <[email protected]>
> > > | 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
> >
> > 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.
>
> Good idea. See attachment.
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]
/// Bram Moolenaar -- [email protected] -- 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 ///
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php