Mercurial > vim
comparison src/syntax.c @ 9027:773d627cac0b v7.4.1799
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 29 22:59:22 2016 +0200
patch 7.4.1799
Problem: 'guicolors' is a confusing option name.
Solution: Use 'termguicolors' instead. (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 29 Apr 2016 23:00:07 +0200 |
parents | b3da1ec8d156 |
children | f06767547415 |
comparison
equal
deleted
inserted
replaced
9026:eea316a77946 | 9027:773d627cac0b |
---|---|
32 int sg_cterm_bold; /* bold attr was set for light color */ | 32 int sg_cterm_bold; /* bold attr was set for light color */ |
33 int sg_cterm_fg; /* terminal fg color number + 1 */ | 33 int sg_cterm_fg; /* terminal fg color number + 1 */ |
34 int sg_cterm_bg; /* terminal bg color number + 1 */ | 34 int sg_cterm_bg; /* terminal bg color number + 1 */ |
35 int sg_cterm_attr; /* Screen attr for color term mode */ | 35 int sg_cterm_attr; /* Screen attr for color term mode */ |
36 /* for when using the GUI */ | 36 /* for when using the GUI */ |
37 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 37 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
38 guicolor_T sg_gui_fg; /* GUI foreground color handle */ | 38 guicolor_T sg_gui_fg; /* GUI foreground color handle */ |
39 guicolor_T sg_gui_bg; /* GUI background color handle */ | 39 guicolor_T sg_gui_bg; /* GUI background color handle */ |
40 #endif | 40 #endif |
41 #ifdef FEAT_GUI | 41 #ifdef FEAT_GUI |
42 guicolor_T sg_gui_sp; /* GUI special color handle */ | 42 guicolor_T sg_gui_sp; /* GUI special color handle */ |
97 static int syn_add_group(char_u *name); | 97 static int syn_add_group(char_u *name); |
98 static int syn_list_header(int did_header, int outlen, int id); | 98 static int syn_list_header(int did_header, int outlen, int id); |
99 static int hl_has_settings(int idx, int check_link); | 99 static int hl_has_settings(int idx, int check_link); |
100 static void highlight_clear(int idx); | 100 static void highlight_clear(int idx); |
101 | 101 |
102 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 102 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
103 static void gui_do_one_color(int idx, int do_menu, int do_tooltip); | 103 static void gui_do_one_color(int idx, int do_menu, int do_tooltip); |
104 static guicolor_T color_name2handle(char_u *name); | 104 static guicolor_T color_name2handle(char_u *name); |
105 #endif | 105 #endif |
106 #ifdef FEAT_GUI | 106 #ifdef FEAT_GUI |
107 static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); | 107 static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); |
7335 * Clear all default highlight groups and load the defaults. | 7335 * Clear all default highlight groups and load the defaults. |
7336 */ | 7336 */ |
7337 for (idx = 0; idx < highlight_ga.ga_len; ++idx) | 7337 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
7338 highlight_clear(idx); | 7338 highlight_clear(idx); |
7339 init_highlight(TRUE, TRUE); | 7339 init_highlight(TRUE, TRUE); |
7340 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 7340 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7341 if (USE_24BIT) | 7341 if (USE_24BIT) |
7342 highlight_gui_started(); | 7342 highlight_gui_started(); |
7343 #endif | 7343 #endif |
7344 highlight_changed(); | 7344 highlight_changed(); |
7345 redraw_later_clear(); | 7345 redraw_later_clear(); |
7790 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) | 7790 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
7791 { | 7791 { |
7792 if (!init) | 7792 if (!init) |
7793 HL_TABLE()[idx].sg_set |= SG_GUI; | 7793 HL_TABLE()[idx].sg_set |= SG_GUI; |
7794 | 7794 |
7795 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 7795 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7796 /* In GUI guifg colors are only used when recognized */ | 7796 /* In GUI guifg colors are only used when recognized */ |
7797 i = color_name2handle(arg); | 7797 i = color_name2handle(arg); |
7798 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 | 7798 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 |
7799 # ifdef FEAT_GUI | 7799 # ifdef FEAT_GUI |
7800 || !(USE_24BIT) | 7800 || !(USE_24BIT) |
7801 # else | 7801 # else |
7802 || !p_guicolors | 7802 || !p_tgc |
7803 # endif | 7803 # endif |
7804 ) | 7804 ) |
7805 { | 7805 { |
7806 HL_TABLE()[idx].sg_gui_fg = i; | 7806 HL_TABLE()[idx].sg_gui_fg = i; |
7807 # endif | 7807 # endif |
7808 vim_free(HL_TABLE()[idx].sg_gui_fg_name); | 7808 vim_free(HL_TABLE()[idx].sg_gui_fg_name); |
7809 if (STRCMP(arg, "NONE")) | 7809 if (STRCMP(arg, "NONE")) |
7810 HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); | 7810 HL_TABLE()[idx].sg_gui_fg_name = vim_strsave(arg); |
7811 else | 7811 else |
7812 HL_TABLE()[idx].sg_gui_fg_name = NULL; | 7812 HL_TABLE()[idx].sg_gui_fg_name = NULL; |
7813 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 7813 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7814 # ifdef FEAT_GUI_X11 | 7814 # ifdef FEAT_GUI_X11 |
7815 if (is_menu_group) | 7815 if (is_menu_group) |
7816 gui.menu_fg_pixel = i; | 7816 gui.menu_fg_pixel = i; |
7817 if (is_scrollbar_group) | 7817 if (is_scrollbar_group) |
7818 gui.scroll_fg_pixel = i; | 7818 gui.scroll_fg_pixel = i; |
7833 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) | 7833 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
7834 { | 7834 { |
7835 if (!init) | 7835 if (!init) |
7836 HL_TABLE()[idx].sg_set |= SG_GUI; | 7836 HL_TABLE()[idx].sg_set |= SG_GUI; |
7837 | 7837 |
7838 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 7838 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7839 /* In GUI guifg colors are only used when recognized */ | 7839 /* In GUI guifg colors are only used when recognized */ |
7840 i = color_name2handle(arg); | 7840 i = color_name2handle(arg); |
7841 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) | 7841 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
7842 { | 7842 { |
7843 HL_TABLE()[idx].sg_gui_bg = i; | 7843 HL_TABLE()[idx].sg_gui_bg = i; |
7845 vim_free(HL_TABLE()[idx].sg_gui_bg_name); | 7845 vim_free(HL_TABLE()[idx].sg_gui_bg_name); |
7846 if (STRCMP(arg, "NONE") != 0) | 7846 if (STRCMP(arg, "NONE") != 0) |
7847 HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); | 7847 HL_TABLE()[idx].sg_gui_bg_name = vim_strsave(arg); |
7848 else | 7848 else |
7849 HL_TABLE()[idx].sg_gui_bg_name = NULL; | 7849 HL_TABLE()[idx].sg_gui_bg_name = NULL; |
7850 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 7850 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
7851 # ifdef FEAT_GUI_X11 | 7851 # ifdef FEAT_GUI_X11 |
7852 if (is_menu_group) | 7852 if (is_menu_group) |
7853 gui.menu_bg_pixel = i; | 7853 gui.menu_bg_pixel = i; |
7854 if (is_scrollbar_group) | 7854 if (is_scrollbar_group) |
7855 gui.scroll_bg_pixel = i; | 7855 gui.scroll_bg_pixel = i; |
8006 /* | 8006 /* |
8007 * Need to update all groups, because they might be using "bg" | 8007 * Need to update all groups, because they might be using "bg" |
8008 * and/or "fg", which have been changed now. | 8008 * and/or "fg", which have been changed now. |
8009 */ | 8009 */ |
8010 #endif | 8010 #endif |
8011 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 8011 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8012 if (USE_24BIT) | 8012 if (USE_24BIT) |
8013 highlight_gui_started(); | 8013 highlight_gui_started(); |
8014 #endif | 8014 #endif |
8015 } | 8015 } |
8016 #ifdef FEAT_GUI_X11 | 8016 #ifdef FEAT_GUI_X11 |
8078 mch_set_normal_colors(); | 8078 mch_set_normal_colors(); |
8079 #else | 8079 #else |
8080 cterm_normal_fg_color = 0; | 8080 cterm_normal_fg_color = 0; |
8081 cterm_normal_fg_bold = 0; | 8081 cterm_normal_fg_bold = 0; |
8082 cterm_normal_bg_color = 0; | 8082 cterm_normal_bg_color = 0; |
8083 # ifdef FEAT_TERMTRUECOLOR | 8083 # ifdef FEAT_TERMGUICOLORS |
8084 cterm_normal_fg_gui_color = INVALCOLOR; | 8084 cterm_normal_fg_gui_color = INVALCOLOR; |
8085 cterm_normal_bg_gui_color = INVALCOLOR; | 8085 cterm_normal_bg_gui_color = INVALCOLOR; |
8086 # endif | 8086 # endif |
8087 #endif | 8087 #endif |
8088 } | 8088 } |
8132 vim_free(HL_TABLE()[idx].sg_gui_bg_name); | 8132 vim_free(HL_TABLE()[idx].sg_gui_bg_name); |
8133 HL_TABLE()[idx].sg_gui_bg_name = NULL; | 8133 HL_TABLE()[idx].sg_gui_bg_name = NULL; |
8134 vim_free(HL_TABLE()[idx].sg_gui_sp_name); | 8134 vim_free(HL_TABLE()[idx].sg_gui_sp_name); |
8135 HL_TABLE()[idx].sg_gui_sp_name = NULL; | 8135 HL_TABLE()[idx].sg_gui_sp_name = NULL; |
8136 #endif | 8136 #endif |
8137 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 8137 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8138 HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; | 8138 HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; |
8139 HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; | 8139 HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; |
8140 #endif | 8140 #endif |
8141 #ifdef FEAT_GUI | 8141 #ifdef FEAT_GUI |
8142 HL_TABLE()[idx].sg_gui_sp = INVALCOLOR; | 8142 HL_TABLE()[idx].sg_gui_sp = INVALCOLOR; |
8156 if (HL_TABLE()[idx].sg_link == 0) | 8156 if (HL_TABLE()[idx].sg_link == 0) |
8157 HL_TABLE()[idx].sg_scriptID = 0; | 8157 HL_TABLE()[idx].sg_scriptID = 0; |
8158 #endif | 8158 #endif |
8159 } | 8159 } |
8160 | 8160 |
8161 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) | 8161 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
8162 /* | 8162 /* |
8163 * Set the normal foreground and background colors according to the "Normal" | 8163 * Set the normal foreground and background colors according to the "Normal" |
8164 * highlighting group. For X11 also set "Menu", "Scrollbar", and | 8164 * highlighting group. For X11 also set "Menu", "Scrollbar", and |
8165 * "Tooltip" colors. | 8165 * "Tooltip" colors. |
8166 */ | 8166 */ |
8167 void | 8167 void |
8168 set_normal_colors(void) | 8168 set_normal_colors(void) |
8169 { | 8169 { |
8170 #ifdef FEAT_GUI | 8170 #ifdef FEAT_GUI |
8171 # ifdef FEAT_TERMTRUECOLOR | 8171 # ifdef FEAT_TERMGUICOLORS |
8172 if (gui.in_use) | 8172 if (gui.in_use) |
8173 # endif | 8173 # endif |
8174 { | 8174 { |
8175 if (set_group_colors((char_u *)"Normal", | 8175 if (set_group_colors((char_u *)"Normal", |
8176 &gui.norm_pixel, &gui.back_pixel, | 8176 &gui.norm_pixel, &gui.back_pixel, |
8208 must_redraw = CLEAR; | 8208 must_redraw = CLEAR; |
8209 } | 8209 } |
8210 # endif | 8210 # endif |
8211 } | 8211 } |
8212 #endif | 8212 #endif |
8213 #ifdef FEAT_TERMTRUECOLOR | 8213 #ifdef FEAT_TERMGUICOLORS |
8214 # ifdef FEAT_GUI | 8214 # ifdef FEAT_GUI |
8215 else | 8215 else |
8216 # endif | 8216 # endif |
8217 { | 8217 { |
8218 int idx; | 8218 int idx; |
8471 } | 8471 } |
8472 } | 8472 } |
8473 | 8473 |
8474 #endif /* FEAT_GUI */ | 8474 #endif /* FEAT_GUI */ |
8475 | 8475 |
8476 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) || defined(PROTO) | 8476 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
8477 /* | 8477 /* |
8478 * Return the handle for a color name. | 8478 * Return the handle for a color name. |
8479 * Returns INVALCOLOR when failed. | 8479 * Returns INVALCOLOR when failed. |
8480 */ | 8480 */ |
8481 static guicolor_T | 8481 static guicolor_T |
8484 if (STRCMP(name, "NONE") == 0) | 8484 if (STRCMP(name, "NONE") == 0) |
8485 return INVALCOLOR; | 8485 return INVALCOLOR; |
8486 | 8486 |
8487 if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) | 8487 if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) |
8488 { | 8488 { |
8489 #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) | 8489 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
8490 if (gui.in_use) | 8490 if (gui.in_use) |
8491 #endif | 8491 #endif |
8492 #ifdef FEAT_GUI | 8492 #ifdef FEAT_GUI |
8493 return gui.norm_pixel; | 8493 return gui.norm_pixel; |
8494 #endif | 8494 #endif |
8495 #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) | 8495 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
8496 else | 8496 else |
8497 #endif | 8497 #endif |
8498 #ifdef FEAT_TERMTRUECOLOR | 8498 #ifdef FEAT_TERMGUICOLORS |
8499 return cterm_normal_fg_gui_color; | 8499 return cterm_normal_fg_gui_color; |
8500 #endif | 8500 #endif |
8501 } | 8501 } |
8502 if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) | 8502 if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) |
8503 { | 8503 { |
8504 #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) | 8504 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
8505 if (gui.in_use) | 8505 if (gui.in_use) |
8506 #endif | 8506 #endif |
8507 #ifdef FEAT_GUI | 8507 #ifdef FEAT_GUI |
8508 return gui.back_pixel; | 8508 return gui.back_pixel; |
8509 #endif | 8509 #endif |
8510 #if defined(FEAT_TERMTRUECOLOR) && defined(FEAT_GUI) | 8510 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
8511 else | 8511 else |
8512 #endif | 8512 #endif |
8513 #ifdef FEAT_TERMTRUECOLOR | 8513 #ifdef FEAT_TERMGUICOLORS |
8514 return cterm_normal_bg_gui_color; | 8514 return cterm_normal_bg_gui_color; |
8515 #endif | 8515 #endif |
8516 } | 8516 } |
8517 | 8517 |
8518 return GUI_GET_COLOR(name); | 8518 return GUI_GET_COLOR(name); |
8593 || (table == &cterm_attr_table | 8593 || (table == &cterm_attr_table |
8594 && aep->ae_u.cterm.fg_color | 8594 && aep->ae_u.cterm.fg_color |
8595 == taep->ae_u.cterm.fg_color | 8595 == taep->ae_u.cterm.fg_color |
8596 && aep->ae_u.cterm.bg_color | 8596 && aep->ae_u.cterm.bg_color |
8597 == taep->ae_u.cterm.bg_color | 8597 == taep->ae_u.cterm.bg_color |
8598 #ifdef FEAT_TERMTRUECOLOR | 8598 #ifdef FEAT_TERMGUICOLORS |
8599 && aep->ae_u.cterm.fg_rgb | 8599 && aep->ae_u.cterm.fg_rgb |
8600 == taep->ae_u.cterm.fg_rgb | 8600 == taep->ae_u.cterm.fg_rgb |
8601 && aep->ae_u.cterm.bg_rgb | 8601 && aep->ae_u.cterm.bg_rgb |
8602 == taep->ae_u.cterm.bg_rgb | 8602 == taep->ae_u.cterm.bg_rgb |
8603 #endif | 8603 #endif |
8665 } | 8665 } |
8666 else if (table == &cterm_attr_table) | 8666 else if (table == &cterm_attr_table) |
8667 { | 8667 { |
8668 taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; | 8668 taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; |
8669 taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; | 8669 taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; |
8670 #ifdef FEAT_TERMTRUECOLOR | 8670 #ifdef FEAT_TERMGUICOLORS |
8671 taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; | 8671 taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; |
8672 taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; | 8672 taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; |
8673 #endif | 8673 #endif |
8674 } | 8674 } |
8675 ++table->ga_len; | 8675 ++table->ga_len; |
8785 new_en.ae_attr |= spell_aep->ae_attr; | 8785 new_en.ae_attr |= spell_aep->ae_attr; |
8786 if (spell_aep->ae_u.cterm.fg_color > 0) | 8786 if (spell_aep->ae_u.cterm.fg_color > 0) |
8787 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; | 8787 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; |
8788 if (spell_aep->ae_u.cterm.bg_color > 0) | 8788 if (spell_aep->ae_u.cterm.bg_color > 0) |
8789 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; | 8789 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; |
8790 #ifdef FEAT_TERMTRUECOLOR | 8790 #ifdef FEAT_TERMGUICOLORS |
8791 if (spell_aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) | 8791 if (spell_aep->ae_u.cterm.fg_rgb != (long_u)INVALCOLOR) |
8792 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; | 8792 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; |
8793 if (spell_aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) | 8793 if (spell_aep->ae_u.cterm.bg_rgb != (long_u)INVALCOLOR) |
8794 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; | 8794 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; |
8795 #endif | 8795 #endif |
9054 sp = TRUE; | 9054 sp = TRUE; |
9055 else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g')) | 9055 else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g')) |
9056 return NULL; | 9056 return NULL; |
9057 if (modec == 'g') | 9057 if (modec == 'g') |
9058 { | 9058 { |
9059 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 9059 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
9060 # ifdef FEAT_GUI | 9060 # ifdef FEAT_GUI |
9061 /* return font name */ | 9061 /* return font name */ |
9062 if (font) | 9062 if (font) |
9063 return HL_TABLE()[id - 1].sg_font_name; | 9063 return HL_TABLE()[id - 1].sg_font_name; |
9064 # endif | 9064 # endif |
9113 return NULL; | 9113 return NULL; |
9114 } | 9114 } |
9115 #endif | 9115 #endif |
9116 | 9116 |
9117 #if (defined(FEAT_SYN_HL) \ | 9117 #if (defined(FEAT_SYN_HL) \ |
9118 && (defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)) \ | 9118 && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) \ |
9119 && defined(FEAT_PRINTER)) || defined(PROTO) | 9119 && defined(FEAT_PRINTER)) || defined(PROTO) |
9120 /* | 9120 /* |
9121 * Return color name of highlight group "id" as RGB value. | 9121 * Return color name of highlight group "id" as RGB value. |
9122 */ | 9122 */ |
9123 long_u | 9123 long_u |
9253 /* | 9253 /* |
9254 * For the color term mode: If there are other than "normal" | 9254 * For the color term mode: If there are other than "normal" |
9255 * highlighting attributes, need to allocate an attr number. | 9255 * highlighting attributes, need to allocate an attr number. |
9256 */ | 9256 */ |
9257 if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 | 9257 if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 |
9258 # ifdef FEAT_TERMTRUECOLOR | 9258 # ifdef FEAT_TERMGUICOLORS |
9259 && sgp->sg_gui_fg == INVALCOLOR | 9259 && sgp->sg_gui_fg == INVALCOLOR |
9260 && sgp->sg_gui_bg == INVALCOLOR | 9260 && sgp->sg_gui_bg == INVALCOLOR |
9261 # endif | 9261 # endif |
9262 ) | 9262 ) |
9263 sgp->sg_cterm_attr = sgp->sg_cterm; | 9263 sgp->sg_cterm_attr = sgp->sg_cterm; |
9264 else | 9264 else |
9265 { | 9265 { |
9266 at_en.ae_attr = sgp->sg_cterm; | 9266 at_en.ae_attr = sgp->sg_cterm; |
9267 at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; | 9267 at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; |
9268 at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; | 9268 at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; |
9269 # ifdef FEAT_TERMTRUECOLOR | 9269 # ifdef FEAT_TERMGUICOLORS |
9270 at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_fg); | 9270 at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_fg); |
9271 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_bg); | 9271 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB(sgp->sg_gui_bg); |
9272 # endif | 9272 # endif |
9273 sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); | 9273 sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); |
9274 } | 9274 } |
9418 } | 9418 } |
9419 | 9419 |
9420 vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(struct hl_group)); | 9420 vim_memset(&(HL_TABLE()[highlight_ga.ga_len]), 0, sizeof(struct hl_group)); |
9421 HL_TABLE()[highlight_ga.ga_len].sg_name = name; | 9421 HL_TABLE()[highlight_ga.ga_len].sg_name = name; |
9422 HL_TABLE()[highlight_ga.ga_len].sg_name_u = vim_strsave_up(name); | 9422 HL_TABLE()[highlight_ga.ga_len].sg_name_u = vim_strsave_up(name); |
9423 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 9423 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
9424 HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; | 9424 HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; |
9425 HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; | 9425 HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; |
9426 # ifdef FEAT_GUI | 9426 # ifdef FEAT_GUI |
9427 HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR; | 9427 HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR; |
9428 # endif | 9428 # endif |
9516 } | 9516 } |
9517 | 9517 |
9518 return hl_id; | 9518 return hl_id; |
9519 } | 9519 } |
9520 | 9520 |
9521 #if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 9521 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
9522 /* | 9522 /* |
9523 * Call this function just after the GUI has started. | 9523 * Call this function just after the GUI has started. |
9524 * It finds the font and color handles for the highlighting groups. | 9524 * It finds the font and color handles for the highlighting groups. |
9525 */ | 9525 */ |
9526 void | 9526 void |
9527 highlight_gui_started(void) | 9527 highlight_gui_started(void) |
9528 { | 9528 { |
9529 int idx; | 9529 int idx; |
9530 | 9530 |
9531 /* First get the colors from the "Normal" and "Menu" group, if set */ | 9531 /* First get the colors from the "Normal" and "Menu" group, if set */ |
9532 # if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR) | 9532 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
9533 # ifdef FEAT_TERMTRUECOLOR | 9533 # ifdef FEAT_TERMGUICOLORS |
9534 if (USE_24BIT) | 9534 if (USE_24BIT) |
9535 # endif | 9535 # endif |
9536 set_normal_colors(); | 9536 set_normal_colors(); |
9537 # endif | 9537 # endif |
9538 | 9538 |
9549 int do_tooltip UNUSED) /* TRUE: might set the tooltip font */ | 9549 int do_tooltip UNUSED) /* TRUE: might set the tooltip font */ |
9550 { | 9550 { |
9551 int didit = FALSE; | 9551 int didit = FALSE; |
9552 | 9552 |
9553 # ifdef FEAT_GUI | 9553 # ifdef FEAT_GUI |
9554 # ifdef FEAT_TERMTRUECOLOR | 9554 # ifdef FEAT_TERMGUICOLORS |
9555 if (gui.in_use) | 9555 if (gui.in_use) |
9556 # endif | 9556 # endif |
9557 if (HL_TABLE()[idx].sg_font_name != NULL) | 9557 if (HL_TABLE()[idx].sg_font_name != NULL) |
9558 { | 9558 { |
9559 hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, | 9559 hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, |