]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1292: statusline not correctly evaluated v9.1.1292
authorHirohito Higashi <h.east.727@gmail.com>
Sat, 12 Apr 2025 09:28:18 +0000 (11:28 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 12 Apr 2025 09:28:18 +0000 (11:28 +0200)
Problem:  statusline not correctly evaluated
          (Peter Kenny, after v9.1.1291)
Solution: revert part of patch v9.1.1291
          (Hirohito Higashi)

fixes: #17095
closes: #17094

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/buffer.c
src/version.c

index 955800e3aeabf12d720f1bb25262ca36aec1fa7d..eed3e8de13f5339e8d0787a3abb32c4a7ef49178 100644 (file)
@@ -4834,14 +4834,25 @@ build_stl_str_hl(
                    && evaldepth < MAX_STL_EVAL_DEPTH)
            {
                size_t parsed_usefmt = (size_t)(block_start - usefmt);
-               size_t new_fmt_len = (parsed_usefmt
-                       + STRLEN(str) + STRLEN(s) + 3) * sizeof(char_u);
-               char_u *new_fmt = (char_u *)alloc(new_fmt_len);
+               size_t str_length = strlen((const char *)str);
+               size_t fmt_length = strlen((const char *)s);
+               size_t new_fmt_len = parsed_usefmt
+                                                + str_length + fmt_length + 3;
+               char_u *new_fmt = (char_u *)alloc(new_fmt_len * sizeof(char_u));
 
                if (new_fmt != NULL)
                {
-                   vim_snprintf((char *)new_fmt, new_fmt_len, "%.*s%s%s%s",
-                       (int)parsed_usefmt, usefmt, str, "%}", s);
+                   char_u *new_fmt_p = new_fmt;
+
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p, usefmt, parsed_usefmt)
+                                                                  + parsed_usefmt;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p , str, str_length)
+                                                                     + str_length;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p, "%}", 2) + 2;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p , s, fmt_length)
+                                                                     + fmt_length;
+                   *new_fmt_p = 0;
+                   new_fmt_p = NULL;
 
                    if (usefmt != fmt)
                        vim_free(usefmt);
index e500aa19e048af86b3be3385bad35d44268a009e..1b1cfd6b32b2e512d85692e84a801d06239b3c43 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1292,
 /**/
     1291,
 /**/