]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0734: function pointer passed to STRNCMP() instead of a length v9.2.0734
authorShane Harper <shane@shaneharper.net>
Fri, 26 Jun 2026 20:45:25 +0000 (20:45 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 26 Jun 2026 20:45:25 +0000 (20:45 +0000)
Problem:  In the popup 'close' option-value completion check, a function
          pointer (the address of close()) was passed as STRNCMP()'s
          third argument instead of the string length.
Solution: Pass the length (close_len). (Shane Harper)

The user-visible effect was negligible: ":set completepopup=close:o<Tab>"
offered no completions instead of "on" and "off".

closes: #20642

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Shane Harper <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/optionstr.c
src/testdir/test_options.vim
src/version.c

index b60e595868ba2a2a21d5789ece4cf4d3a2ae4668..b187dc3192dcf631014d61d1cfe268b848df3c2d 100644 (file)
@@ -3516,7 +3516,7 @@ expand_set_popupoption(optexpand_T *args, int *numMatches, char_u ***matches,
        int is_border = xp->xp_pattern - args->oe_set_arg >= border_len &&
                STRNCMP(xp->xp_pattern - border_len, "border:", border_len) == 0;
        int is_close = xp->xp_pattern - args->oe_set_arg >= close_len &&
-               STRNCMP(xp->xp_pattern - close_len, "close:", close) == 0;
+               STRNCMP(xp->xp_pattern - close_len, "close:", close_len) == 0;
        int is_resize = xp->xp_pattern - args->oe_set_arg >= resize_len &&
                STRNCMP(xp->xp_pattern - resize_len, "resize:", resize_len) == 0;
        int is_shadow = xp->xp_pattern - args->oe_set_arg >= shadow_len &&
index 4b7eea1b2f8aee981e5416ba5dbded29de82d7e6..7580ace6db953f47726b78e327eb5cf00e42afc9 100644 (file)
@@ -663,6 +663,9 @@ func Test_set_completion_string_values()
   call feedkeys(":set completepopup=height:10,align:\<Tab>\<C-B>\"\<CR>", 'xt')
   call assert_equal('"set completepopup=height:10,align:item', @:)
   call assert_equal([], getcompletion('set completepopup=bogusname:', 'cmdline'))
+  call assert_equal(['on', 'off'], getcompletion('set completepopup=close:', 'cmdline'))
+  call assert_equal(['on', 'off'], getcompletion('set completepopup=close:o', 'cmdline'))
+  call assert_equal(['off'], getcompletion('set previewpopup=close:of', 'cmdline'))
 
   " opacity: numeric, 0..100 only
   call assert_true(index(getcompletion('set completepopup=', 'cmdline'),
index 742ff9a216407e70a93910c0431964d5d3c233b1..85bb6d17e139933b73de43b1560d704a63abf478 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    734,
 /**/
     733,
 /**/