diff options
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 100 |
1 files changed, 77 insertions, 23 deletions
diff --git a/src/screen.c b/src/screen.c index b92cbf9e2..5dc8ffe28 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7828,7 +7828,7 @@ screen_start_highlight(int attr) { if (attr > HL_ALL) /* special HL attr. */ { - if (t_colors > 1) + if (IS_CTERM) aep = syn_cterm_attr2entry(attr); else aep = syn_term_attr2entry(attr); @@ -7839,8 +7839,16 @@ screen_start_highlight(int attr) } if ((attr & HL_BOLD) && T_MD != NULL) /* bold */ out_str(T_MD); - else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color - && cterm_normal_fg_bold) + else if (aep != NULL && cterm_normal_fg_bold && +#ifdef FEAT_TERMTRUECOLOR + (p_guicolors ? + (aep->ae_u.cterm.fg_rgb != INVALCOLOR): +#endif + (t_colors > 1 && aep->ae_u.cterm.fg_color) +#ifdef FEAT_TERMTRUECOLOR + ) +#endif + ) /* If the Normal FG color has BOLD attribute and the new HL * has a FG color defined, clear BOLD. */ out_str(T_ME); @@ -7860,17 +7868,29 @@ screen_start_highlight(int attr) */ if (aep != NULL) { - if (t_colors > 1) +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors) { - if (aep->ae_u.cterm.fg_color) - term_fg_color(aep->ae_u.cterm.fg_color - 1); - if (aep->ae_u.cterm.bg_color) - term_bg_color(aep->ae_u.cterm.bg_color - 1); + if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) + term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); + if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) + term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); } else +#endif { - if (aep->ae_u.term.start != NULL) - out_str(aep->ae_u.term.start); + if (t_colors > 1) + { + if (aep->ae_u.cterm.fg_color) + term_fg_color(aep->ae_u.cterm.fg_color - 1); + if (aep->ae_u.cterm.bg_color) + term_bg_color(aep->ae_u.cterm.bg_color - 1); + } + else + { + if (aep->ae_u.term.start != NULL) + out_str(aep->ae_u.term.start); + } } } } @@ -7904,14 +7924,23 @@ screen_stop_highlight(void) { attrentry_T *aep; - if (t_colors > 1) + if (IS_CTERM) { /* * Assume that t_me restores the original colors! */ aep = syn_cterm_attr2entry(screen_attr); - if (aep != NULL && (aep->ae_u.cterm.fg_color - || aep->ae_u.cterm.bg_color)) + if (aep != NULL && +#ifdef FEAT_TERMTRUECOLOR + (p_guicolors ? + (aep->ae_u.cterm.fg_rgb != INVALCOLOR || + aep->ae_u.cterm.bg_rgb != INVALCOLOR): +#endif + (aep->ae_u.cterm.fg_color || aep->ae_u.cterm.bg_color) +#ifdef FEAT_TERMTRUECOLOR + ) +#endif + ) do_ME = TRUE; } else @@ -7959,15 +7988,27 @@ screen_stop_highlight(void) if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) out_str(T_ME); - if (t_colors > 1) +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors) { - /* set Normal cterm colors */ - if (cterm_normal_fg_color != 0) - term_fg_color(cterm_normal_fg_color - 1); - if (cterm_normal_bg_color != 0) - term_bg_color(cterm_normal_bg_color - 1); - if (cterm_normal_fg_bold) - out_str(T_MD); + if (cterm_normal_fg_gui_color != INVALCOLOR) + term_fg_rgb_color(cterm_normal_fg_gui_color); + if (cterm_normal_bg_gui_color != INVALCOLOR) + term_bg_rgb_color(cterm_normal_bg_gui_color); + } + else +#endif + { + if (t_colors > 1) + { + /* set Normal cterm colors */ + if (cterm_normal_fg_color != 0) + term_fg_color(cterm_normal_fg_color - 1); + if (cterm_normal_bg_color != 0) + term_bg_color(cterm_normal_bg_color - 1); + if (cterm_normal_fg_bold) + out_str(T_MD); + } } } } @@ -7981,10 +8022,17 @@ screen_stop_highlight(void) void reset_cterm_colors(void) { - if (t_colors > 1) + if (IS_CTERM) { /* set Normal cterm colors */ +#ifdef FEAT_TERMTRUECOLOR + if (p_guicolors ? + (cterm_normal_fg_gui_color != INVALCOLOR + || cterm_normal_bg_gui_color != INVALCOLOR): + (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) +#else if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) +#endif { out_str(T_OP); screen_attr = -1; @@ -8228,7 +8276,7 @@ screen_fill( #ifdef FEAT_GUI !gui.in_use && #endif - t_colors <= 1); + !IS_CTERM); for (row = start_row; row < end_row; ++row) { #ifdef FEAT_MBYTE @@ -8911,6 +8959,9 @@ can_clear(char_u *p) #ifdef FEAT_GUI || gui.in_use #endif +#ifdef FEAT_TERMTRUECOLOR + || (p_guicolors && cterm_normal_bg_gui_color != INVALCOLOR) +#endif || cterm_normal_bg_color == 0 || *T_UT != NUL)); } @@ -10242,6 +10293,9 @@ draw_tabline(void) #ifdef FEAT_GUI && !gui.in_use #endif +#ifdef FEAT_TERMTRUECOLOR + && !p_guicolors +#endif ); redraw_tabline = FALSE; |