diff options
author | watiko <service@mail.watiko.net> | 2016-02-07 09:58:52 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-11 15:13:30 +0900 |
commit | 4a0e10fb2c584ae5cbd95041373944663fa8755d (patch) | |
tree | 9fc10619cff40528c198f7baf35473f86f142205 /src/nvim/normal.c | |
parent | 84281bf675f77f417d26a68611406ef43fd82f7f (diff) | |
download | rneovim-4a0e10fb2c584ae5cbd95041373944663fa8755d.tar.gz rneovim-4a0e10fb2c584ae5cbd95041373944663fa8755d.tar.bz2 rneovim-4a0e10fb2c584ae5cbd95041373944663fa8755d.zip |
vim-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)
https://github.com/vim/vim/commit/d009e8682686a56f7565e6e093a42cd0596e121f
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 049d650f86..233be6d32d 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++; } } } |