]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1263: string length wrong in get_last_inserted_save() v9.1.1263
authorChrist van Willegen <cvwillegen@gmail.com>
Sun, 30 Mar 2025 13:26:01 +0000 (15:26 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 30 Mar 2025 13:26:01 +0000 (15:26 +0200)
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>
src/edit.c
src/version.c

index a2a004c12413f094829d8a87be731decd40d6960..3fa95cdb05ff981aaee2f6831c99b2594a97f7eb 100644 (file)
@@ -3022,7 +3022,7 @@ get_last_insert_save(void)
        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;
 }
 
index ec6acb61051144a9bb28d83baaab31584dde0a12..75cbd635dcfd1db1a66cf926b68c16168061260e 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1263,
 /**/
     1262,
 /**/