0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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 #2120)
This commit is contained in:
Bram Moolenaar
2017-09-25 22:57:27 +02:00
parent 0c6a32963d
commit 452030e530
2 changed files with 56 additions and 23 deletions

View File

@@ -7969,6 +7969,8 @@ do_highlight(
} }
else if (STRCMP(key, "GUIFG") == 0) else if (STRCMP(key, "GUIFG") == 0)
{ {
char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL) #if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{ {
@@ -7982,22 +7984,33 @@ do_highlight(
{ {
HL_TABLE()[idx].sg_gui_fg = i; HL_TABLE()[idx].sg_gui_fg = i;
# endif # endif
vim_free(HL_TABLE()[idx].sg_gui_fg_name); if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0) if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); *namep = vim_strsave(arg);
else else
HL_TABLE()[idx].sg_gui_fg_name = NULL; *namep = NULL;
}
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
# ifdef FEAT_GUI_X11 # ifdef FEAT_GUI_X11
if (is_menu_group) if (is_menu_group && gui.menu_fg_pixel != i)
{
gui.menu_fg_pixel = i; gui.menu_fg_pixel = i;
if (is_scrollbar_group)
gui.scroll_fg_pixel = i;
# ifdef FEAT_BEVAL
if (is_tooltip_group)
gui.tooltip_fg_pixel = i;
# endif
do_colors = TRUE; do_colors = TRUE;
}
if (is_scrollbar_group && gui.scroll_fg_pixel != i)
{
gui.scroll_fg_pixel = i;
do_colors = TRUE;
}
# ifdef FEAT_BEVAL
if (is_tooltip_group && gui.tooltip_fg_pixel != i)
{
gui.tooltip_fg_pixel = i;
do_colors = TRUE;
}
# endif
# endif # endif
} }
# endif # endif
@@ -8006,6 +8019,8 @@ do_highlight(
} }
else if (STRCMP(key, "GUIBG") == 0) else if (STRCMP(key, "GUIBG") == 0)
{ {
char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL) #if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{ {
@@ -8019,22 +8034,33 @@ do_highlight(
{ {
HL_TABLE()[idx].sg_gui_bg = i; HL_TABLE()[idx].sg_gui_bg = i;
# endif # endif
vim_free(HL_TABLE()[idx].sg_gui_bg_name); if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0) if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); *namep = vim_strsave(arg);
else else
HL_TABLE()[idx].sg_gui_bg_name = NULL; *namep = NULL;
}
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
# ifdef FEAT_GUI_X11 # ifdef FEAT_GUI_X11
if (is_menu_group) if (is_menu_group && gui.menu_bg_pixel != i)
{
gui.menu_bg_pixel = i; gui.menu_bg_pixel = i;
if (is_scrollbar_group)
gui.scroll_bg_pixel = i;
# ifdef FEAT_BEVAL
if (is_tooltip_group)
gui.tooltip_bg_pixel = i;
# endif
do_colors = TRUE; do_colors = TRUE;
}
if (is_scrollbar_group && gui.scroll_bg_pixel != i)
{
gui.scroll_bg_pixel = i;
do_colors = TRUE;
}
# ifdef FEAT_BEVAL
if (is_tooltip_group && gui.tooltip_bg_pixel != i)
{
gui.tooltip_bg_pixel = i;
do_colors = TRUE;
}
# endif
# endif # endif
} }
# endif # endif
@@ -8043,6 +8069,8 @@ do_highlight(
} }
else if (STRCMP(key, "GUISP") == 0) else if (STRCMP(key, "GUISP") == 0)
{ {
char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL) #if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{ {
@@ -8055,11 +8083,14 @@ do_highlight(
{ {
HL_TABLE()[idx].sg_gui_sp = i; HL_TABLE()[idx].sg_gui_sp = i;
# endif # endif
vim_free(HL_TABLE()[idx].sg_gui_sp_name); if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0) if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_sp_name = vim_strsave(arg); *namep = vim_strsave(arg);
else else
HL_TABLE()[idx].sg_gui_sp_name = NULL; *namep = NULL;
}
# ifdef FEAT_GUI # ifdef FEAT_GUI
} }
# endif # endif

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1146,
/**/ /**/
1145, 1145,
/**/ /**/