mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 03:46:31 +00:00
vim-patch:8.0.1146: redraw when highlight is set with same names
Problem: Redraw when highlight is set with same names. (Ozaki Kiichi)
Solution: Only free and save a name when it changed. (closes vim/vim#2120)
452030e530
This commit is contained in:
@@ -6823,58 +6823,70 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "GUIFG") == 0) {
|
} else if (strcmp(key, "GUIFG") == 0) {
|
||||||
|
char_u **const namep = &HL_TABLE()[idx].sg_rgb_fg_name;
|
||||||
|
|
||||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
||||||
if (!init) {
|
if (!init) {
|
||||||
HL_TABLE()[idx].sg_set |= SG_GUI;
|
HL_TABLE()[idx].sg_set |= SG_GUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(HL_TABLE()[idx].sg_rgb_fg_name);
|
if (*namep == NULL || STRCMP(*namep, arg) != 0) {
|
||||||
|
xfree(*namep);
|
||||||
if (strcmp(arg, "NONE") != 0) {
|
if (strcmp(arg, "NONE") != 0) {
|
||||||
HL_TABLE()[idx].sg_rgb_fg_name = (char_u *)xstrdup((char *)arg);
|
*namep = (char_u *)xstrdup(arg);
|
||||||
HL_TABLE()[idx].sg_rgb_fg = name_to_color((const char_u *)arg);
|
HL_TABLE()[idx].sg_rgb_fg = name_to_color((char_u *)arg);
|
||||||
} else {
|
} else {
|
||||||
HL_TABLE()[idx].sg_rgb_fg_name = NULL;
|
*namep = NULL;
|
||||||
HL_TABLE()[idx].sg_rgb_fg = -1;
|
HL_TABLE()[idx].sg_rgb_fg = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_normal_group) {
|
if (is_normal_group) {
|
||||||
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
|
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
|
||||||
}
|
}
|
||||||
} else if (STRCMP(key, "GUIBG") == 0) {
|
} else if (STRCMP(key, "GUIBG") == 0) {
|
||||||
|
char_u **const namep = &HL_TABLE()[idx].sg_rgb_bg_name;
|
||||||
|
|
||||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
||||||
if (!init) {
|
if (!init) {
|
||||||
HL_TABLE()[idx].sg_set |= SG_GUI;
|
HL_TABLE()[idx].sg_set |= SG_GUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(HL_TABLE()[idx].sg_rgb_bg_name);
|
if (*namep == NULL || STRCMP(*namep, arg) != 0) {
|
||||||
|
xfree(*namep);
|
||||||
if (STRCMP(arg, "NONE") != 0) {
|
if (STRCMP(arg, "NONE") != 0) {
|
||||||
HL_TABLE()[idx].sg_rgb_bg_name = (char_u *)xstrdup((char *)arg);
|
*namep = (char_u *)xstrdup(arg);
|
||||||
HL_TABLE()[idx].sg_rgb_bg = name_to_color((const char_u *)arg);
|
HL_TABLE()[idx].sg_rgb_bg = name_to_color((char_u *)arg);
|
||||||
} else {
|
} else {
|
||||||
HL_TABLE()[idx].sg_rgb_bg_name = NULL;
|
*namep = NULL;
|
||||||
HL_TABLE()[idx].sg_rgb_bg = -1;
|
HL_TABLE()[idx].sg_rgb_bg = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_normal_group) {
|
if (is_normal_group) {
|
||||||
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
|
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "GUISP") == 0) {
|
} else if (strcmp(key, "GUISP") == 0) {
|
||||||
|
char_u **const namep = &HL_TABLE()[idx].sg_rgb_sp_name;
|
||||||
|
|
||||||
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
|
||||||
if (!init) {
|
if (!init) {
|
||||||
HL_TABLE()[idx].sg_set |= SG_GUI;
|
HL_TABLE()[idx].sg_set |= SG_GUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(HL_TABLE()[idx].sg_rgb_sp_name);
|
if (*namep == NULL || STRCMP(*namep, arg) != 0) {
|
||||||
|
xfree(*namep);
|
||||||
if (strcmp(arg, "NONE") != 0) {
|
if (strcmp(arg, "NONE") != 0) {
|
||||||
HL_TABLE()[idx].sg_rgb_sp_name = (char_u *)xstrdup((char *)arg);
|
*namep = (char_u *)xstrdup(arg);
|
||||||
HL_TABLE()[idx].sg_rgb_sp = name_to_color((const char_u *)arg);
|
HL_TABLE()[idx].sg_rgb_sp = name_to_color((char_u *)arg);
|
||||||
} else {
|
} else {
|
||||||
HL_TABLE()[idx].sg_rgb_sp_name = NULL;
|
*namep = NULL;
|
||||||
HL_TABLE()[idx].sg_rgb_sp = -1;
|
HL_TABLE()[idx].sg_rgb_sp = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_normal_group) {
|
if (is_normal_group) {
|
||||||
normal_sp = HL_TABLE()[idx].sg_rgb_sp;
|
normal_sp = HL_TABLE()[idx].sg_rgb_sp;
|
||||||
|
Reference in New Issue
Block a user