Permalink
Browse files

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)
  • Loading branch information...
brammool committed Sep 25, 2017
1 parent 0c6a329 commit 452030e530aad9b08fcfa71737d098b33c752b85
Showing with 56 additions and 23 deletions.
  1. +54 −23 src/syntax.c
  2. +2 −0 src/version.c
View
@@ -7969,6 +7969,8 @@ do_highlight(
}
else if (STRCMP(key, "GUIFG") == 0)
{
char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{
@@ -7982,22 +7984,33 @@ do_highlight(
{
HL_TABLE()[idx].sg_gui_fg = i;
# endif
vim_free(HL_TABLE()[idx].sg_gui_fg_name);
if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_fg_name = NULL;
if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0)
*namep = vim_strsave(arg);
else
*namep = NULL;
}
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
# ifdef FEAT_GUI_X11
if (is_menu_group)
if (is_menu_group && gui.menu_fg_pixel != i)
{
gui.menu_fg_pixel = i;
if (is_scrollbar_group)
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)
if (is_tooltip_group && gui.tooltip_fg_pixel != i)
{
gui.tooltip_fg_pixel = i;
do_colors = TRUE;
}
# endif
do_colors = TRUE;
# endif
}
# endif
@@ -8006,6 +8019,8 @@ do_highlight(
}
else if (STRCMP(key, "GUIBG") == 0)
{
char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{
@@ -8019,22 +8034,33 @@ do_highlight(
{
HL_TABLE()[idx].sg_gui_bg = i;
# endif
vim_free(HL_TABLE()[idx].sg_gui_bg_name);
if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_bg_name = NULL;
if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0)
*namep = vim_strsave(arg);
else
*namep = NULL;
}
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
# ifdef FEAT_GUI_X11
if (is_menu_group)
if (is_menu_group && gui.menu_bg_pixel != i)
{
gui.menu_bg_pixel = i;
if (is_scrollbar_group)
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)
if (is_tooltip_group && gui.tooltip_bg_pixel != i)
{
gui.tooltip_bg_pixel = i;
do_colors = TRUE;
}
# endif
do_colors = TRUE;
# endif
}
# endif
@@ -8043,6 +8069,8 @@ do_highlight(
}
else if (STRCMP(key, "GUISP") == 0)
{
char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name;
#if defined(FEAT_GUI) || defined(FEAT_EVAL)
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI))
{
@@ -8055,11 +8083,14 @@ do_highlight(
{
HL_TABLE()[idx].sg_gui_sp = i;
# endif
vim_free(HL_TABLE()[idx].sg_gui_sp_name);
if (STRCMP(arg, "NONE") != 0)
HL_TABLE()[idx].sg_gui_sp_name = vim_strsave(arg);
else
HL_TABLE()[idx].sg_gui_sp_name = NULL;
if (*namep == NULL || STRCMP(*namep, arg) != 0)
{
vim_free(*namep);
if (STRCMP(arg, "NONE") != 0)
*namep = vim_strsave(arg);
else
*namep = NULL;
}
# ifdef FEAT_GUI
}
# endif
View
@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1146,
/**/
1145,
/**/

0 comments on commit 452030e

Please sign in to comment.