summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-06-09 20:20:03 +0200
committerBram Moolenaar <Bram@vim.org>2015-06-09 20:20:03 +0200
commitd009e8682686a56f7565e6e093a42cd0596e121f (patch)
tree6c08acb9d982596486b039203dd362691aef1342 /src/normal.c
parentd68f2219b57acb86ddedebdcc1476fee15c9c0c7 (diff)
downloadvim-git-d009e8682686a56f7565e6e093a42cd0596e121f.tar.gz
patch 7.4.734v7.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)
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/normal.c b/src/normal.c
index 0ec803733..38a9f81b4 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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;
}
}
}