Commit: patch 9.2.0766: quick_tab entries for empty letters point to the wrong index

1 view
Skip to first unread message

Christian Brabandt

unread,
2:45 PM (3 hours ago) 2:45 PM
to vim...@googlegroups.com
patch 9.2.0766: quick_tab entries for empty letters point to the wrong index

Commit: https://github.com/vim/vim/commit/e068a12f9fde92079b1770dd8bc2df6867dec7ef
Author: Illia Bobyr <illia...@gmail.com>
Date: Thu Jul 2 18:28:59 2026 +0000

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

diff --git a/src/option.c b/src/option.c
index d15cc3f3c..9d291d180 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 dd14dedba..2c531eb5b 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,
/**/
Reply all
Reply to author
Forward
0 new messages