Mercurial > vim
comparison src/screen.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 | 65c3e8259124 |
children | 69517d67421f |
comparison
equal
deleted
inserted
replaced
13338:0afa358885dc | 13339:da2a9e217200 |
---|---|
8064 else | 8064 else |
8065 attr = aep->ae_attr; | 8065 attr = aep->ae_attr; |
8066 } | 8066 } |
8067 if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */ | 8067 if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */ |
8068 out_str(T_MD); | 8068 out_str(T_MD); |
8069 else if (aep != NULL && cterm_normal_fg_bold && | 8069 else if (aep != NULL && cterm_normal_fg_bold && ( |
8070 #ifdef FEAT_TERMGUICOLORS | 8070 #ifdef FEAT_TERMGUICOLORS |
8071 (p_tgc ? | 8071 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR |
8072 (aep->ae_u.cterm.fg_rgb != INVALCOLOR): | 8072 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR |
8073 #endif | 8073 : |
8074 (t_colors > 1 && aep->ae_u.cterm.fg_color) | 8074 #endif |
8075 #ifdef FEAT_TERMGUICOLORS | 8075 t_colors > 1 && aep->ae_u.cterm.fg_color)) |
8076 ) | |
8077 #endif | |
8078 ) | |
8079 /* If the Normal FG color has BOLD attribute and the new HL | 8076 /* If the Normal FG color has BOLD attribute and the new HL |
8080 * has a FG color defined, clear BOLD. */ | 8077 * has a FG color defined, clear BOLD. */ |
8081 out_str(T_ME); | 8078 out_str(T_ME); |
8082 if ((attr & HL_STANDOUT) && *T_SO != NUL) /* standout */ | 8079 if ((attr & HL_STANDOUT) && *T_SO != NUL) /* standout */ |
8083 out_str(T_SO); | 8080 out_str(T_SO); |
8099 * bold etc. override the color setting. | 8096 * bold etc. override the color setting. |
8100 */ | 8097 */ |
8101 if (aep != NULL) | 8098 if (aep != NULL) |
8102 { | 8099 { |
8103 #ifdef FEAT_TERMGUICOLORS | 8100 #ifdef FEAT_TERMGUICOLORS |
8104 if (p_tgc) | 8101 /* When 'termguicolors' is set but fg or bg is unset, |
8102 * fall back to the cterm colors. This helps for SpellBad, | |
8103 * where the GUI uses a red undercurl. */ | |
8104 if (p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR) | |
8105 { | 8105 { |
8106 if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) | 8106 if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) |
8107 term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); | 8107 term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); |
8108 } | |
8109 else | |
8110 #endif | |
8111 if (t_colors > 1) | |
8112 { | |
8113 if (aep->ae_u.cterm.fg_color) | |
8114 term_fg_color(aep->ae_u.cterm.fg_color - 1); | |
8115 } | |
8116 #ifdef FEAT_TERMGUICOLORS | |
8117 if (p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR) | |
8118 { | |
8108 if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) | 8119 if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) |
8109 term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); | 8120 term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); |
8110 } | 8121 } |
8111 else | 8122 else |
8112 #endif | 8123 #endif |
8113 { | 8124 if (t_colors > 1) |
8114 if (t_colors > 1) | 8125 { |
8115 { | 8126 if (aep->ae_u.cterm.bg_color) |
8116 if (aep->ae_u.cterm.fg_color) | 8127 term_bg_color(aep->ae_u.cterm.bg_color - 1); |
8117 term_fg_color(aep->ae_u.cterm.fg_color - 1); | 8128 } |
8118 if (aep->ae_u.cterm.bg_color) | 8129 |
8119 term_bg_color(aep->ae_u.cterm.bg_color - 1); | 8130 if (t_colors <= 1) |
8120 } | 8131 { |
8121 else | 8132 if (aep->ae_u.term.start != NULL) |
8122 { | 8133 out_str(aep->ae_u.term.start); |
8123 if (aep->ae_u.term.start != NULL) | |
8124 out_str(aep->ae_u.term.start); | |
8125 } | |
8126 } | 8134 } |
8127 } | 8135 } |
8128 } | 8136 } |
8129 } | 8137 } |
8130 } | 8138 } |
8160 { | 8168 { |
8161 /* | 8169 /* |
8162 * Assume that t_me restores the original colors! | 8170 * Assume that t_me restores the original colors! |
8163 */ | 8171 */ |
8164 aep = syn_cterm_attr2entry(screen_attr); | 8172 aep = syn_cterm_attr2entry(screen_attr); |
8165 if (aep != NULL && | 8173 if (aep != NULL && (( |
8166 #ifdef FEAT_TERMGUICOLORS | 8174 #ifdef FEAT_TERMGUICOLORS |
8167 (p_tgc ? | 8175 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR |
8168 (aep->ae_u.cterm.fg_rgb != INVALCOLOR | 8176 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR |
8169 || aep->ae_u.cterm.bg_rgb != INVALCOLOR): | 8177 : |
8170 #endif | 8178 #endif |
8171 (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) | 8179 aep->ae_u.cterm.fg_color) || ( |
8172 #ifdef FEAT_TERMGUICOLORS | 8180 #ifdef FEAT_TERMGUICOLORS |
8173 ) | 8181 p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR |
8174 #endif | 8182 ? aep->ae_u.cterm.bg_rgb != INVALCOLOR |
8175 ) | 8183 : |
8184 #endif | |
8185 aep->ae_u.cterm.bg_color))) | |
8176 do_ME = TRUE; | 8186 do_ME = TRUE; |
8177 } | 8187 } |
8178 else | 8188 else |
8179 { | 8189 { |
8180 aep = syn_term_attr2entry(screen_attr); | 8190 aep = syn_term_attr2entry(screen_attr); |