aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-09-30 22:34:41 +0200
committerGitHub <noreply@github.com>2020-09-30 22:34:41 +0200
commitc007b961f53e0a38fdec23bac4777493dceeab12 (patch)
tree439ad79a0ec632c7ac8b4e40bf0d05169ffecfcd /src/nvim/ops.c
parente5d98d85693245fec811307e5a2ccfdea3a350cd (diff)
parent02dcc3c11ad72e0ae3c6704af6b08d9275ed5470 (diff)
downloadrneovim-c007b961f53e0a38fdec23bac4777493dceeab12.tar.gz
rneovim-c007b961f53e0a38fdec23bac4777493dceeab12.tar.bz2
rneovim-c007b961f53e0a38fdec23bac4777493dceeab12.zip
Merge pull request #12733 from KillTheMule/lnume
[RDY]: Fix buffer_updates on blockwise paste
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index d1f2e9e4f1..8329daf5f1 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3109,6 +3109,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
for (i = 0; i < y_size; i++) {
int spaces;
char shortline;
+ // can just be 0 or 1, needed for blockwise paste beyond the current
+ // buffer end
+ int lines_appended = 0;
bd.startspaces = 0;
bd.endspaces = 0;
@@ -3122,6 +3125,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
break;
}
nr_lines++;
+ lines_appended = 1;
}
/* get the old line and advance to the position to insert at */
oldp = get_cursor_line_ptr();
@@ -3194,14 +3198,15 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
memmove(ptr, oldp + bd.textcol + delcount, (size_t)columns);
ml_replace(curwin->w_cursor.lnum, newp, false);
extmark_splice_cols(curbuf, (int)curwin->w_cursor.lnum-1, bd.textcol,
- delcount, (int)totlen, kExtmarkUndo);
+ delcount, (int)totlen + lines_appended, kExtmarkUndo);
++curwin->w_cursor.lnum;
if (i == 0)
curwin->w_cursor.col += bd.startspaces;
}
- changed_lines(lnum, 0, curwin->w_cursor.lnum, nr_lines, true);
+ changed_lines(lnum, 0, curbuf->b_op_start.lnum + (linenr_T)y_size
+ - (linenr_T)nr_lines , nr_lines, true);
/* Set '[ mark. */
curbuf->b_op_start = curwin->w_cursor;