Skip to content

Commit fa16e43

Browse files
committed
patch 9.1.0715: Not correctly parsing color names (after v9.1.0709)
Problem: Not correctly parsing color names (chdiza, after v9.1.0709) Solution: Revert part of the patch that compares the color names and fall-back to the macro STRICMP fixes: #15617 closes: #15619 Signed-off-by: Christian Brabandt <[email protected]>
1 parent eccc927 commit fa16e43

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/highlight.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,8 +1215,8 @@ highlight_set_cterm_color(
12151215

12161216
target.key = 0;
12171217
target.value = (char *)arg;
1218-
target.length = 0; // not used, see cmp_keyvalue_value_ni()
1219-
entry = (keyvalue_T *)bsearch(&target, &color_name_tab, ARRAY_LENGTH(color_name_tab), sizeof(color_name_tab[0]), cmp_keyvalue_value_ni);
1218+
target.length = 0; // not used, see cmp_keyvalue_value_i()
1219+
entry = (keyvalue_T *)bsearch(&target, &color_name_tab, ARRAY_LENGTH(color_name_tab), sizeof(color_name_tab[0]), cmp_keyvalue_value_i);
12201220
if (entry == NULL)
12211221
{
12221222
semsg(_(e_color_name_or_number_not_recognized_str), key_start);
@@ -2542,8 +2542,8 @@ gui_get_color_cmn(char_u *name)
25422542

25432543
target.key = 0;
25442544
target.value = (char *)name;
2545-
target.length = 0; // not used, see cmp_keyvalue_value_ni()
2546-
entry = (keyvalue_T *)bsearch(&target, &rgb_tab, ARRAY_LENGTH(rgb_tab), sizeof(rgb_tab[0]), cmp_keyvalue_value_ni);
2545+
target.length = 0; // not used, see cmp_keyvalue_value_i()
2546+
entry = (keyvalue_T *)bsearch(&target, &rgb_tab, ARRAY_LENGTH(rgb_tab), sizeof(rgb_tab[0]), cmp_keyvalue_value_i);
25472547
if (entry != NULL)
25482548
return gui_adjust_rgb((guicolor_T)entry->key);
25492549

src/misc2.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,6 +3090,16 @@ cmp_keyvalue_value_n(const void *a, const void *b)
30903090
return STRNCMP(kv1->value, kv2->value, MAX(kv1->length, kv2->length));
30913091
}
30923092

3093+
// compare two keyvalue_T structs by case insensitive value
3094+
int
3095+
cmp_keyvalue_value_i(const void *a, const void *b)
3096+
{
3097+
keyvalue_T *kv1 = (keyvalue_T *)a;
3098+
keyvalue_T *kv2 = (keyvalue_T *)b;
3099+
3100+
return STRICMP(kv1->value, kv2->value);
3101+
}
3102+
30933103
// compare two keyvalue_T structs by case insensitive ASCII value
30943104
// with length
30953105
int

src/proto/misc2.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@ int build_argv_from_list(list_T *l, char ***argv, int *argc);
6363
int get_special_pty_type(void);
6464
int cmp_keyvalue_value(const void *a, const void *b);
6565
int cmp_keyvalue_value_n(const void *a, const void *b);
66+
int cmp_keyvalue_value_i(const void *a, const void *b);
6667
int cmp_keyvalue_value_ni(const void *a, const void *b);
6768
/* vim: set ft=c : */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
715,
707709
/**/
708710
714,
709711
/**/

0 commit comments

Comments
 (0)