patch 9.1.1263: string length wrong in get_last_inserted_save()
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: #16961
Signed-off-by: Christ van Willegen <cvwillegen@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/edit.c b/src/edit.c
index a2a004c..3fa95cd 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3022,7 +3022,7 @@
return NULL;
if (insert.length > 0 && s[insert.length - 1] == ESC) // remove trailing ESC
- s[insert.length - 1] = NUL;
+ s[--insert.length] = NUL;
return s;
}