aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-09-24 05:11:19 -0700
committerGitHub <noreply@github.com>2021-09-24 05:11:19 -0700
commit55d1e630b4d66ecb774824c9839e7f5821d23341 (patch)
tree3cea9697a6aac623f1cd38134a319f1973c98171 /src/nvim/ops.c
parent7a26eb8a567cbc831d4f629f9eccb767a44436b8 (diff)
parentf1bf70c2f9f24a1cd3b75fa762f8ca57f9ff24cf (diff)
downloadrneovim-55d1e630b4d66ecb774824c9839e7f5821d23341.tar.gz
rneovim-55d1e630b4d66ecb774824c9839e7f5821d23341.tar.bz2
rneovim-55d1e630b4d66ecb774824c9839e7f5821d23341.zip
Merge #15731 vim-patch:7.4.725,8.2.{0597,0598,0924,1035}
fixes #14581
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 12fb8439f1..1d737ee9fc 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -804,12 +804,6 @@ bool valid_yank_reg(int regname, bool writing)
return false;
}
-typedef enum {
- YREG_PASTE,
- YREG_YANK,
- YREG_PUT,
-} yreg_mode_t;
-
/// Return yankreg_T to use, according to the value of `regname`.
/// Cannot handle the '_' (black hole) register.
/// Must only be called with a valid register name!
@@ -3650,6 +3644,12 @@ int get_register_name(int num)
}
}
+/// @return the index of the register "" points to.
+int get_unname_register(void)
+{
+ return y_previous == NULL ? -1 : (int)(y_previous - &y_regs[0]);
+}
+
/*
* ":dis" and ":registers": Display the contents of the yank registers.
*/
@@ -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,