From: Illia Bobyr Date: Thu, 2 Jul 2026 18:28:59 +0000 (+0000) Subject: patch 9.2.0766: quick_tab entries for empty letters point to the wrong index X-Git-Tag: v9.2.0766^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e068a12f9fde92079b1770dd8bc2df6867dec7ef;p=thirdparty%2Fvim.git patch 9.2.0766: quick_tab entries for empty letters point to the wrong index Problem: Letters with no options (like "y" and "z") have their quick_tab entry left at 0, so lookups for those letters start scanning at options[0] instead of failing fast. Solution: Set entries for letters with no option names to the last-option index, so such lookups stop immediately (Illia Bobyr) closes: #20684 Signed-off-by: Illia Bobyr Signed-off-by: Christian Brabandt --- diff --git a/src/option.c b/src/option.c index d15cc3f3c5..9d291d1809 100644 --- a/src/option.c +++ b/src/option.c @@ -5587,9 +5587,19 @@ findoption(char_u *arg) // letter. There are 26 letters, plus the first "t_" option. if (quick_tab[1] == 0) { + // Make sure we do not leave any entries uninitialized, even if we have + // no options that start with a particular letter. + int last_opt_idx; + for (last_opt_idx = 0; options[last_opt_idx].fullname != NULL; + last_opt_idx++) + ; + for (int tab_idx = 1; tab_idx < 27; tab_idx++) + quick_tab[tab_idx] = last_opt_idx; + p = options[0].fullname; - for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++) + for (opt_idx = 1; opt_idx < last_opt_idx; opt_idx++) { + s = options[opt_idx].fullname; if (s[0] != p[0]) { if (s[0] == 't' && s[1] == '_') diff --git a/src/version.c b/src/version.c index dd14dedba2..2c531eb5bc 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 766, /**/ 765, /**/