aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-13 08:47:18 +0800
committerGitHub <noreply@github.com>2024-01-13 08:47:18 +0800
commit786089013d33666a2acb5ba86fb34c716a9cab26 (patch)
tree49958ccc99d0dde40e37abaf1a8e0c4f31715112 /src
parentc8f696f2b0c289a88054c20e0415051ebe017eb3 (diff)
parent64a50d08c4866011be73d6af0e8ae90e06c3f949 (diff)
downloadrneovim-786089013d33666a2acb5ba86fb34c716a9cab26.tar.gz
rneovim-786089013d33666a2acb5ba86fb34c716a9cab26.tar.bz2
rneovim-786089013d33666a2acb5ba86fb34c716a9cab26.zip
Merge pull request #26911 from zeertzjq/vim-8.2.3439
vim-patch:8.2.3439,9.1.{0015,0021}
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ops.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 8386dcaec6..84cba5d05c 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1282,9 +1282,25 @@ int insert_reg(int regname, bool literally_arg)
} else {
for (size_t i = 0; i < reg->y_size; i++) {
if (regname == '-') {
+ Direction dir = BACKWARD;
+ if ((State & REPLACE_FLAG) != 0) {
+ pos_T curpos;
+ u_save_cursor();
+ if (u_save_cursor() == FAIL) {
+ return FAIL;
+ }
+ del_chars(mb_charlen(reg->y_array[0]), true);
+ curpos = curwin->w_cursor;
+ if (oneright() == FAIL) {
+ // hit end of line, need to put forward (after the current position)
+ dir = FORWARD;
+ }
+ curwin->w_cursor = curpos;
+ }
+
AppendCharToRedobuff(Ctrl_R);
AppendCharToRedobuff(regname);
- do_put(regname, NULL, BACKWARD, 1, PUT_CURSEND);
+ do_put(regname, NULL, dir, 1, PUT_CURSEND);
} else {
stuffescaped(reg->y_array[i], literally);
}