0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.734

Problem:    ml_get error when using "p" in a Visual selection in the last
            line.
Solution:   Change the behavior at the last line. (Yukihiro Nakadaira)
This commit is contained in:
Bram Moolenaar
2015-06-09 20:20:03 +02:00
parent d68f2219b5
commit d009e86826
5 changed files with 194 additions and 54 deletions

View File

@@ -1547,8 +1547,10 @@ do_pending_operator(cap, old_col, gui_yank)
}
/* In Select mode, a linewise selection is operated upon like a
* characterwise selection. */
if (VIsual_select && VIsual_mode == 'V')
* characterwise selection.
* Special case: gH<Del> deletes the last line. */
if (VIsual_select && VIsual_mode == 'V'
&& cap->oap->op_type != OP_DELETE)
{
if (lt(VIsual, curwin->w_cursor))
{
@@ -1770,24 +1772,16 @@ do_pending_operator(cap, old_col, gui_yank)
oap->inclusive = FALSE;
/* 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))
if (*p_sel != 'o'
&& !op_on_lines(oap->op_type)
&& oap->end.lnum < curbuf->b_ml.ml_line_count)
{
if (oap->end.lnum < curbuf->b_ml.ml_line_count)
{
++oap->end.lnum;
oap->end.col = 0;
++oap->end.lnum;
oap->end.col = 0;
#ifdef FEAT_VIRTUALEDIT
oap->end.coladd = 0;
oap->end.coladd = 0;
#endif
++oap->line_count;
}
else
{
/* Cannot move below the last line, make the op
* inclusive to tell the operation to include the
* line break. */
oap->inclusive = TRUE;
}
++oap->line_count;
}
}
}