aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-02-11 03:35:09 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-02-11 03:35:09 -0500
commit63d750f310539edc94b3193b9142eb784518a25a (patch)
treeb40bec81c1ff2f39ac55930e1c8b76aab0158dbc /src/nvim/normal.c
parent84281bf675f77f417d26a68611406ef43fd82f7f (diff)
parentbfab33ef7975d8edd467964e59e0d39bf687ed92 (diff)
downloadrneovim-63d750f310539edc94b3193b9142eb784518a25a.tar.gz
rneovim-63d750f310539edc94b3193b9142eb784518a25a.tar.bz2
rneovim-63d750f310539edc94b3193b9142eb784518a25a.zip
Merge pull request #4186 from watiko/vim-7.4.929
vim-patch:7.4.{734,743,929}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 049d650f86..e6c5354941 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1538,9 +1538,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
curbuf->b_visual_mode_eval = VIsual_mode;
}
- /* In Select mode, a linewise selection is operated upon like a
- * characterwise selection. */
- if (VIsual_select && VIsual_mode == 'V') {
+ // In Select mode, a linewise selection is operated upon like a
+ // 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)) {
VIsual.col = 0;
curwin->w_cursor.col =
@@ -1676,20 +1678,15 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
&& (include_line_break || !virtual_op)
) {
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 (oap->end.lnum < curbuf->b_ml.ml_line_count) {
- ++oap->end.lnum;
- oap->end.col = 0;
- oap->end.coladd = 0;
- ++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;
- }
+ // 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;
+ oap->end.coladd = 0;
+ oap->line_count++;
}
}
}
@@ -7748,6 +7745,10 @@ static void nv_put(cmdarg_T *cap)
if (was_visual) {
curbuf->b_visual.vi_start = curbuf->b_op_start;
curbuf->b_visual.vi_end = curbuf->b_op_end;
+ // need to adjust cursor position
+ if (*p_sel == 'e') {
+ inc(&curbuf->b_visual.vi_end);
+ }
}
/* When all lines were selected and deleted do_put() leaves an empty