Hi Bram!
On So, 20 Mär 2011, Bram Moolenaar wrote:
>
> Christian Brabandt wrote:
>
> > On Do, 17 Mär 2011, Bram Moolenaar wrote:
> >
> > > If you do gH<Del> it deletes the line. It's only on the last line that
> > > it makes the line empty. Let's call that a bug.
> > >
> > > Someone who wants to fix this?
> >
> > diff --git a/src/normal.c b/src/normal.c
> > --- a/src/normal.c
> > +++ b/src/normal.c
> > @@ -1776,6 +1776,11 @@
> > ++oap->line_count;
> > }
> > }
> > + if ( VIsual_select
> > + && ( cap->nchar == 'H' || (oap->start.col == 0
> > + && oap->end.col ==
> > (colnr_T)STRLEN(ml_get(oap->end.lnum))-1))
> > + && *p_sel != 'o')
> > + oap->motion_type = MLINE;
> > }
> >
> > redo_VIsual_busy = FALSE;
> >
> > That also fixes the bug, that when you select a whole line with the
> > mouse and press delete, the line is left empty.
>
> Thanks. I wonder why gH doesn't set the motion to linewise anyway. If
> you do gH<Del> in any line but the last it already deletes the whole
> line. Your patch doesn't check the line number, while it was only wrong
> in the last line. So perhaps it needs to be solved elsewhere?
Yeah, that is confusing. But just above these lines there is this code:
/* Try to include the newline, unless it's an operator
* that works on lines only */
if (*p_sel != 'o'
&& !op_on_lines(oap->op_type)
&& oap->end.lnum < curbuf->b_ml.ml_line_count)
{
++oap->end.lnum;
oap->end.col = 0;
# ifdef FEAT_VIRTUALEDIT
oap->end.coladd = 0;
# endif
++oap->line_count;
}
This will not trigger, when the last line is selected, cause obviously,
oap->end.lnum is not smaller then b_ml.ml_line_count. And as I
understand the code, this will take care of selecting the newlines.
regards,
Christian
--
Der beste Hellseher ist der, der gut raten kann.
-- Euripides (580-406 v. Chr.)
--
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