1
0
forked from aniani/vim

patch 9.1.0709: GUIEnter event not found in Turkish locale

Problem:   GUIEnter not found in Turkish locale
           (James McCoy, after v9.1.0256, the issue was there before,
            but v9.1.0256 made it more apparent)
Solution:  explicitly compare autocommand events by ASCII value and
           ignoring locale, because according to the documentation,
           events are case insensitive (:h autocommand-events)

fixes: #15574
closes: #15603

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-09-02 09:59:18 +02:00
parent bd69b39514
commit 84e3175c4e
7 changed files with 55 additions and 17 deletions

View File

@@ -589,6 +589,33 @@ vim_strnicmp(char *s1, char *s2, size_t len)
}
#endif
/*
* Compare two ASCII strings, for length "len", ignoring case, ignoring locale
* (mostly matters for turkish locale where i I might be different).
* return 0 for match, < 0 for smaller, > 0 for bigger
*/
int
vim_strnicmp_asc(char *s1, char *s2, size_t len)
{
int i;
int save_cmp_flags = cmp_flags;
cmp_flags |= CMP_KEEPASCII; // compare by ASCII value, ignoring locale
while (len > 0)
{
i = vim_tolower(*s1) - vim_tolower(*s2);
if (i != 0)
break; // this character is different
if (*s1 == NUL)
break; // strings match until NUL
++s1;
++s2;
--len;
}
cmp_flags = save_cmp_flags;
return i;
}
/*
* Search for first occurrence of "c" in "string".
* Version of strchr() that handles unsigned char strings with characters from