From f8241f825a87fe811fb8831f4414eaa2bad2dcfe Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Wed, 22 Sep 2021 23:43:42 +0100 Subject: [PATCH] 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... --- src/nvim/ops.c | 5 +++++ 1 file changed, 5 insertions(+) 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,