summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-25 22:57:27 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-25 22:57:27 +0200
commit452030e530aad9b08fcfa71737d098b33c752b85 (patch)
tree63a47bee7eed8fab344be5e2d3407b924a856035 /src/syntax.c
parent0c6a32963d1c0b5401ffd7f25e6fc7bf86895744 (diff)
downloadvim-git-452030e530aad9b08fcfa71737d098b33c752b85.tar.gz
patch 8.0.1146: redraw when highlight is set with same namesv8.0.1146
Problem: Redraw when highlight is set with same names. (Ozaki Kiichi) Solution: Only free and save a name when it changed. (closes #2120)
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c77
1 files changed, 54 insertions, 23 deletions
diff --git a/src/syntax.c b/src/syntax.c
index e0736cb63..4e4548d17 100644
--- a/src/syntax.c
+++ b/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