Commit: patch 9.1.1263: string length wrong in get_last_inserted_save()

2 views
Skip to first unread message

Christian Brabandt

unread,
Mar 30, 2025, 9:30:13 AM3/30/25
to vim...@googlegroups.com
patch 9.1.1263: string length wrong in get_last_inserted_save()

Commit: https://github.com/vim/vim/commit/583f5aee96940c29ba17ffb87f1ddf56741b72ba
Author: Christ van Willegen <cvwil...@gmail.com>
Date: Sun Mar 30 15:26:01 2025 +0200

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 <cvwil...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/edit.c b/src/edit.c
index a2a004c12..3fa95cdb0 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -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;
}

diff --git a/src/version.c b/src/version.c
index ec6acb610..75cbd635d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1263,
/**/
1262,
/**/
Reply all
Reply to author
Forward
0 new messages