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:
77
src/syntax.c
77
src/syntax.c
@@ -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
|
||||
|
Reference in New Issue
Block a user