aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-18 06:07:13 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-03-18 06:12:40 +0800
commitd717f8605a05dad4c050ac1e0731c7aba572fe59 (patch)
tree8f065387ba252cc85633847ddbc9eced28e0dd01 /src
parent59d8d50c5bbcfb9215eddc0f4314fdd1cce55422 (diff)
downloadrneovim-d717f8605a05dad4c050ac1e0731c7aba572fe59.tar.gz
rneovim-d717f8605a05dad4c050ac1e0731c7aba572fe59.tar.bz2
rneovim-d717f8605a05dad4c050ac1e0731c7aba572fe59.zip
vim-patch:9.1.1216: Pasting the '.' register multiple times may not work
Problem: Pasting the '.' register multiple times may work incorrectly when the last insert starts with Ctrl-D and ends with '0'. (after 9.1.1212) Solution: Restore the missing assignment (zeertzjq). closes: vim/vim#16908 https://github.com/vim/vim/commit/61b354442418539056cc7073a9aec353d297836c
Diffstat (limited to 'src')
-rw-r--r--src/nvim/edit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index f5e40d0491..a81d1416f1 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -2708,20 +2708,21 @@ int stuff_inserted(int c, int count, int no_esc)
}
if (insert->size > 0) {
- char *p;
// look for the last ESC in 'insert'
- for (p = insert->data + (insert->size - 1); p >= insert->data; p--) {
+ for (char *p = insert->data + insert->size - 1; p >= insert->data; p--) {
if (*p == ESC) {
insert->size = (size_t)(p - insert->data);
break;
}
}
+ }
+ if (insert->size > 0) {
+ char *p = insert->data + insert->size - 1;
// when the last char is either "0" or "^" it will be quoted if no ESC
// comes after it OR if it will inserted more than once and "ptr"
// starts with ^D. -- Acevedo
- if (p >= insert->data
- && (*p == '0' || *p == '^')
+ if ((*p == '0' || *p == '^')
&& (no_esc || (*insert->data == Ctrl_D && count > 1))) {
last = *p;
insert->size--;