Mercurial > vim
comparison src/syntax.c @ 12535:523162252b06 v8.0.1146
patch 8.0.1146: redraw when highlight is set with same names
commit https://github.com/vim/vim/commit/452030e530aad9b08fcfa71737d098b33c752b85
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 25 22:57:27 2017 +0200
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 https://github.com/vim/vim/issues/2120)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 25 Sep 2017 23:00:05 +0200 |
parents | b85c981b3a8e |
children | a24356fd94d8 |
comparison
equal
deleted
inserted
replaced
12534:d76c4e18f431 | 12535:523162252b06 |
---|---|
7967 } | 7967 } |
7968 } | 7968 } |
7969 } | 7969 } |
7970 else if (STRCMP(key, "GUIFG") == 0) | 7970 else if (STRCMP(key, "GUIFG") == 0) |
7971 { | 7971 { |
7972 char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name; | |
7973 | |
7972 #if defined(FEAT_GUI) || defined(FEAT_EVAL) | 7974 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
7973 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) | 7975 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
7974 { | 7976 { |
7975 if (!init) | 7977 if (!init) |
7976 HL_TABLE()[idx].sg_set |= SG_GUI; | 7978 HL_TABLE()[idx].sg_set |= SG_GUI; |
7980 i = color_name2handle(arg); | 7982 i = color_name2handle(arg); |
7981 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) | 7983 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
7982 { | 7984 { |
7983 HL_TABLE()[idx].sg_gui_fg = i; | 7985 HL_TABLE()[idx].sg_gui_fg = i; |
7984 # endif | 7986 # endif |
7985 vim_free(HL_TABLE()[idx].sg_gui_fg_name); | 7987 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
7986 if (STRCMP(arg, "NONE") != 0) | 7988 { |
7987 HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); | 7989 vim_free(*namep); |
7988 else | 7990 if (STRCMP(arg, "NONE") != 0) |
7989 HL_TABLE()[idx].sg_gui_fg_name = NULL; | 7991 *namep = vim_strsave(arg); |
7992 else | |
7993 *namep = NULL; | |
7994 } | |
7990 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) | 7995 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7991 # ifdef FEAT_GUI_X11 | 7996 # ifdef FEAT_GUI_X11 |
7992 if (is_menu_group) | 7997 if (is_menu_group && gui.menu_fg_pixel != i) |
7998 { | |
7993 gui.menu_fg_pixel = i; | 7999 gui.menu_fg_pixel = i; |
7994 if (is_scrollbar_group) | 8000 do_colors = TRUE; |
8001 } | |
8002 if (is_scrollbar_group && gui.scroll_fg_pixel != i) | |
8003 { | |
7995 gui.scroll_fg_pixel = i; | 8004 gui.scroll_fg_pixel = i; |
8005 do_colors = TRUE; | |
8006 } | |
7996 # ifdef FEAT_BEVAL | 8007 # ifdef FEAT_BEVAL |
7997 if (is_tooltip_group) | 8008 if (is_tooltip_group && gui.tooltip_fg_pixel != i) |
8009 { | |
7998 gui.tooltip_fg_pixel = i; | 8010 gui.tooltip_fg_pixel = i; |
8011 do_colors = TRUE; | |
8012 } | |
7999 # endif | 8013 # endif |
8000 do_colors = TRUE; | |
8001 # endif | 8014 # endif |
8002 } | 8015 } |
8003 # endif | 8016 # endif |
8004 } | 8017 } |
8005 #endif | 8018 #endif |
8006 } | 8019 } |
8007 else if (STRCMP(key, "GUIBG") == 0) | 8020 else if (STRCMP(key, "GUIBG") == 0) |
8008 { | 8021 { |
8022 char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name; | |
8023 | |
8009 #if defined(FEAT_GUI) || defined(FEAT_EVAL) | 8024 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8010 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) | 8025 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
8011 { | 8026 { |
8012 if (!init) | 8027 if (!init) |
8013 HL_TABLE()[idx].sg_set |= SG_GUI; | 8028 HL_TABLE()[idx].sg_set |= SG_GUI; |
8017 i = color_name2handle(arg); | 8032 i = color_name2handle(arg); |
8018 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) | 8033 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
8019 { | 8034 { |
8020 HL_TABLE()[idx].sg_gui_bg = i; | 8035 HL_TABLE()[idx].sg_gui_bg = i; |
8021 # endif | 8036 # endif |
8022 vim_free(HL_TABLE()[idx].sg_gui_bg_name); | 8037 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
8023 if (STRCMP(arg, "NONE") != 0) | 8038 { |
8024 HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); | 8039 vim_free(*namep); |
8025 else | 8040 if (STRCMP(arg, "NONE") != 0) |
8026 HL_TABLE()[idx].sg_gui_bg_name = NULL; | 8041 *namep = vim_strsave(arg); |
8042 else | |
8043 *namep = NULL; | |
8044 } | |
8027 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) | 8045 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8028 # ifdef FEAT_GUI_X11 | 8046 # ifdef FEAT_GUI_X11 |
8029 if (is_menu_group) | 8047 if (is_menu_group && gui.menu_bg_pixel != i) |
8048 { | |
8030 gui.menu_bg_pixel = i; | 8049 gui.menu_bg_pixel = i; |
8031 if (is_scrollbar_group) | 8050 do_colors = TRUE; |
8051 } | |
8052 if (is_scrollbar_group && gui.scroll_bg_pixel != i) | |
8053 { | |
8032 gui.scroll_bg_pixel = i; | 8054 gui.scroll_bg_pixel = i; |
8055 do_colors = TRUE; | |
8056 } | |
8033 # ifdef FEAT_BEVAL | 8057 # ifdef FEAT_BEVAL |
8034 if (is_tooltip_group) | 8058 if (is_tooltip_group && gui.tooltip_bg_pixel != i) |
8059 { | |
8035 gui.tooltip_bg_pixel = i; | 8060 gui.tooltip_bg_pixel = i; |
8061 do_colors = TRUE; | |
8062 } | |
8036 # endif | 8063 # endif |
8037 do_colors = TRUE; | |
8038 # endif | 8064 # endif |
8039 } | 8065 } |
8040 # endif | 8066 # endif |
8041 } | 8067 } |
8042 #endif | 8068 #endif |
8043 } | 8069 } |
8044 else if (STRCMP(key, "GUISP") == 0) | 8070 else if (STRCMP(key, "GUISP") == 0) |
8045 { | 8071 { |
8072 char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name; | |
8073 | |
8046 #if defined(FEAT_GUI) || defined(FEAT_EVAL) | 8074 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8047 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) | 8075 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
8048 { | 8076 { |
8049 if (!init) | 8077 if (!init) |
8050 HL_TABLE()[idx].sg_set |= SG_GUI; | 8078 HL_TABLE()[idx].sg_set |= SG_GUI; |
8053 i = color_name2handle(arg); | 8081 i = color_name2handle(arg); |
8054 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) | 8082 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !gui.in_use) |
8055 { | 8083 { |
8056 HL_TABLE()[idx].sg_gui_sp = i; | 8084 HL_TABLE()[idx].sg_gui_sp = i; |
8057 # endif | 8085 # endif |
8058 vim_free(HL_TABLE()[idx].sg_gui_sp_name); | 8086 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
8059 if (STRCMP(arg, "NONE") != 0) | 8087 { |
8060 HL_TABLE()[idx].sg_gui_sp_name = vim_strsave(arg); | 8088 vim_free(*namep); |
8061 else | 8089 if (STRCMP(arg, "NONE") != 0) |
8062 HL_TABLE()[idx].sg_gui_sp_name = NULL; | 8090 *namep = vim_strsave(arg); |
8091 else | |
8092 *namep = NULL; | |
8093 } | |
8063 # ifdef FEAT_GUI | 8094 # ifdef FEAT_GUI |
8064 } | 8095 } |
8065 # endif | 8096 # endif |
8066 } | 8097 } |
8067 #endif | 8098 #endif |