diff src/screen.c @ 18786:1756fe125914 v8.1.2382

patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work Commit: https://github.com/vim/vim/commit/a050b9471c66b383ed674bfd57ac78016199d972 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 2 21:35:31 2019 +0100 patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work Problem: MS-Windows: When using VTP bold+inverse doesn't work. Solution: Compare with the default colors. (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/5303)
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Dec 2019 21:45:04 +0100
parents 49b78d6465e5
children d34ec6fe207d
line wrap: on
line diff
--- a/src/screen.c
+++ b/src/screen.c
@@ -1777,6 +1777,33 @@ screen_start_highlight(int attr)
 		else
 		    attr = aep->ae_attr;
 	    }
+#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
+	    if (use_vtp())
+	    {
+		guicolor_T  defguifg, defguibg;
+		int	    defctermfg, defctermbg;
+
+		// If FG and BG are unset, the color is undefined when
+		// BOLD+INVERSE. Use Normal as the default value.
+		get_default_console_color(&defctermfg, &defctermbg, &defguifg,
+								    &defguibg);
+
+		if (p_tgc)
+		{
+		    if (aep == NULL || COLOR_INVALID(aep->ae_u.cterm.fg_rgb))
+			term_fg_rgb_color(defguifg);
+		    if (aep == NULL || COLOR_INVALID(aep->ae_u.cterm.bg_rgb))
+			term_bg_rgb_color(defguibg);
+		}
+		else if (t_colors >= 256)
+		{
+		    if (aep == NULL || aep->ae_u.cterm.fg_color == 0)
+			term_fg_color(defctermfg);
+		    if (aep == NULL || aep->ae_u.cterm.bg_color == 0)
+			term_bg_color(defctermbg);
+		}
+	    }
+#endif
 	    if ((attr & HL_BOLD) && *T_MD != NUL)	/* bold */
 		out_str(T_MD);
 	    else if (aep != NULL && cterm_normal_fg_bold && (