comparison src/syntax.c @ 13339:da2a9e217200 v8.0.1544

patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show commit https://github.com/vim/vim/commit/d4fc577e60d325777d38c00bd78fb9a32c7b1dfa Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 27 14:39:03 2018 +0100 patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show Problem: When using 'termguicolors' SpellBad doesn't show. Solution: When the GUI colors are not set fall back to the cterm colors.
author Christian Brabandt <cb@256bit.org>
date Tue, 27 Feb 2018 14:45:06 +0100
parents 1b7522243dde
children 33f514c94943
comparison
equal deleted inserted replaced
13338:0afa358885dc 13339:da2a9e217200
8950 { 8950 {
8951 attrentry_T at_en; 8951 attrentry_T at_en;
8952 8952
8953 vim_memset(&at_en, 0, sizeof(attrentry_T)); 8953 vim_memset(&at_en, 0, sizeof(attrentry_T));
8954 at_en.ae_attr = attr; 8954 at_en.ae_attr = attr;
8955 at_en.ae_u.cterm.fg_rgb = fg; 8955 if (fg == INVALCOLOR && bg == INVALCOLOR)
8956 at_en.ae_u.cterm.bg_rgb = bg; 8956 {
8957 /* If both GUI colors are not set fall back to the cterm colors. Helps
8958 * if the GUI only has an attribute, such as undercurl. */
8959 at_en.ae_u.cterm.fg_rgb = CTERMCOLOR;
8960 at_en.ae_u.cterm.bg_rgb = CTERMCOLOR;
8961 }
8962 else
8963 {
8964 at_en.ae_u.cterm.fg_rgb = fg;
8965 at_en.ae_u.cterm.bg_rgb = bg;
8966 }
8957 return get_attr_entry(&cterm_attr_table, &at_en); 8967 return get_attr_entry(&cterm_attr_table, &at_en);
8958 } 8968 }
8959 #endif 8969 #endif
8960 8970
8961 #if defined(FEAT_GUI) || defined(PROTO) 8971 #if defined(FEAT_GUI) || defined(PROTO)
9092 if (spell_aep->ae_u.cterm.fg_color > 0) 9102 if (spell_aep->ae_u.cterm.fg_color > 0)
9093 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; 9103 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color;
9094 if (spell_aep->ae_u.cterm.bg_color > 0) 9104 if (spell_aep->ae_u.cterm.bg_color > 0)
9095 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; 9105 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color;
9096 #ifdef FEAT_TERMGUICOLORS 9106 #ifdef FEAT_TERMGUICOLORS
9097 if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) 9107 /* If both fg and bg are not set fall back to cterm colors.
9098 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; 9108 * Helps for SpellBad which uses undercurl in the GUI. */
9099 if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) 9109 if (COLOR_INVALID(spell_aep->ae_u.cterm.fg_rgb)
9100 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; 9110 && COLOR_INVALID(spell_aep->ae_u.cterm.bg_rgb))
9111 {
9112 if (spell_aep->ae_u.cterm.fg_color > 0)
9113 new_en.ae_u.cterm.fg_rgb = CTERMCOLOR;
9114 if (spell_aep->ae_u.cterm.bg_color > 0)
9115 new_en.ae_u.cterm.bg_rgb = CTERMCOLOR;
9116 }
9117 else
9118 {
9119 if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR)
9120 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb;
9121 if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
9122 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb;
9123 }
9101 #endif 9124 #endif
9102 } 9125 }
9103 } 9126 }
9104 return get_attr_entry(&cterm_attr_table, &new_en); 9127 return get_attr_entry(&cterm_attr_table, &new_en);
9105 } 9128 }
9590 9613
9591 } 9614 }
9592 # endif 9615 # endif
9593 at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg); 9616 at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg);
9594 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); 9617 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg);
9618 if (at_en.ae_u.cterm.fg_rgb == INVALCOLOR
9619 && at_en.ae_u.cterm.bg_rgb == INVALCOLOR)
9620 {
9621 /* If both fg and bg are invalid fall back to the cterm colors.
9622 * Helps when the GUI only uses an attribute, e.g. undercurl. */
9623 at_en.ae_u.cterm.fg_rgb = CTERMCOLOR;
9624 at_en.ae_u.cterm.bg_rgb = CTERMCOLOR;
9625 }
9595 # endif 9626 # endif
9596 sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); 9627 sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en);
9597 } 9628 }
9598 } 9629 }
9599 9630