aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-02-07 12:12:07 +0900
committerwatiko <service@mail.watiko.net>2016-02-11 15:13:30 +0900
commit663e1ed158956a75845642974ab81bba1826ff05 (patch)
treea418eb5b777ef485320cfd579a909df6554c098c /src
parent4a0e10fb2c584ae5cbd95041373944663fa8755d (diff)
downloadrneovim-663e1ed158956a75845642974ab81bba1826ff05.tar.gz
rneovim-663e1ed158956a75845642974ab81bba1826ff05.tar.bz2
rneovim-663e1ed158956a75845642974ab81bba1826ff05.zip
vim-patch:7.4.743
Problem: "p" in Visual mode causes an unexpected line split. Solution: Advance the cursor first. (Yukihiro Nakadaira) https://github.com/vim/vim/commit/c004bc2726eafc7a56d1d9f8398a65a0a7dc8d6c
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ops.c26
-rw-r--r--src/nvim/version.c2
2 files changed, 19 insertions, 9 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index fd3424509f..b1adc85e1d 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -2664,17 +2664,27 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
if (y_type == MLINE) {
if (flags & PUT_LINE_SPLIT) {
- /* "p" or "P" in Visual mode: split the lines to put the text in
- * between. */
- if (u_save_cursor() == FAIL)
+ // "p" or "P" in Visual mode: split the lines to put the text in
+ // between.
+ if (u_save_cursor() == FAIL) {
goto end;
- ptr = vim_strsave(get_cursor_pos_ptr());
- ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE);
+ }
+ char_u *p = get_cursor_pos_ptr();
+ if (dir == FORWARD && *p != NUL) {
+ mb_ptr_adv(p);
+ }
+ ptr = vim_strsave(p);
+ ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, false);
xfree(ptr);
- ptr = vim_strnsave(get_cursor_line_ptr(), curwin->w_cursor.col);
- ml_replace(curwin->w_cursor.lnum, ptr, FALSE);
- ++nr_lines;
+ oldp = get_cursor_line_ptr();
+ p = oldp + curwin->w_cursor.col;
+ if (dir == FORWARD && *p != NUL) {
+ mb_ptr_adv(p);
+ }
+ ptr = vim_strnsave(oldp, p - oldp);
+ ml_replace(curwin->w_cursor.lnum, ptr, false);
+ nr_lines++;
dir = FORWARD;
}
if (flags & PUT_LINE_FORWARD) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 90bf3c7572..4ecfd634a2 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -545,7 +545,7 @@ static int included_patches[] = {
746,
745,
// 744 NA
- // 743,
+ 743,
742,
741,
740,