diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-30 22:30:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 14:30:18 +0000 |
commit | 76cbe9c8f8746d6affa2be788986019dc9a6ea2c (patch) | |
tree | 98b5522bc729aefba2027816a2f3a11561ecf7ce | |
parent | e87d2ae3836cabe456ba781b479f28a6f1f46137 (diff) | |
download | rneovim-76cbe9c8f8746d6affa2be788986019dc9a6ea2c.tar.gz rneovim-76cbe9c8f8746d6affa2be788986019dc9a6ea2c.tar.bz2 rneovim-76cbe9c8f8746d6affa2be788986019dc9a6ea2c.zip |
vim-patch:9.1.1263: string length wrong in get_last_inserted_save() (#33194)
Problem: string length wrong in get_last_inserted_save()
(after v9.1.1222)
Solution: when removing trailing ESC, also decrease the string length
(Christ van Willegen)
closes: vim/vim#16961
https://github.com/vim/vim/commit/583f5aee96940c29ba17ffb87f1ddf56741b72ba
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
-rw-r--r-- | src/nvim/edit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index f2001b6f6f..4eeba5e38d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2774,7 +2774,7 @@ char *get_last_insert_save(void) char *s = xmemdupz(insert.data, insert.size); if (insert.size > 0 && s[insert.size - 1] == ESC) { // remain trailing ESC - s[insert.size - 1] = NUL; + s[--insert.size] = NUL; } return s; } |