diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-22 23:43:42 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-23 02:04:16 +0100 |
commit | f8241f825a87fe811fb8831f4414eaa2bad2dcfe (patch) | |
tree | db827b23e208012579975c7cae0b8615d74ee542 /src | |
parent | f9779facca2cb9c8115aa1cbdd2fb71d105b8ebf (diff) | |
download | rneovim-f8241f825a87fe811fb8831f4414eaa2bad2dcfe.tar.gz rneovim-f8241f825a87fe811fb8831f4414eaa2bad2dcfe.tar.bz2 rneovim-f8241f825a87fe811fb8831f4414eaa2bad2dcfe.zip |
vim-patch:7.4.725
Problem: ":call setreg('"', [])" reports an internal error.
Solution: Make the register empty. (Yasuhiro Matsumoto)
https://github.com/vim/vim/commit/659c94d483b2fdad949c14a42cee96f99a66394b
Required for v8.2.1035.
Note that setreg('"', []) didn't cause an internal error for us, but
didn't clear the register properly either...
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 15f63c3179..1d737ee9fc 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5560,6 +5560,11 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str } } + // Without any lines make the register empty. + if (y_ptr->y_size + newlines == 0) { + XFREE_CLEAR(y_ptr->y_array); + return; + } // Grow the register array to hold the pointers to the new lines. char_u **pp = xrealloc(y_ptr->y_array, |