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

583f5aee96

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
This commit is contained in:
zeertzjq
2025-03-30 22:30:18 +08:00
committed by GitHub
parent e87d2ae383
commit 76cbe9c8f8

View File

@@ -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;
}