changeset 12969:a9f6a874b64f v8.0.1360

patch 8.0.1360: the Terminal highlighting doesn't work in a terminal commit https://github.com/vim/vim/commit/76bb7196f5102c9929959d710e8ed97a19affa4d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 30 22:07:07 2017 +0100 patch 8.0.1360: the Terminal highlighting doesn't work in a terminal Problem: The Terminal highlighting doesn't work in a terminal. (Ozaki Kiichi) Solution: Use the Terminal highlighting when the cterm index is zero.
author Christian Brabandt <cb@256bit.org>
date Thu, 30 Nov 2017 22:15:05 +0100
parents 45987b1b77dc
children 06d24dd1299b
files src/terminal.c src/version.c
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1833,6 +1833,23 @@ cell2attr(VTermScreenCellAttrs cellattrs
 	int fg = color2index(&cellfg, TRUE, &bold);
 	int bg = color2index(&cellbg, FALSE, &bold);
 
+	/* Use the "Terminal" highlighting for the default colors. */
+	if (fg == 0 || bg == 0)
+	{
+	    int id = syn_name2id((char_u *)"Terminal");
+
+	    if (id != 0 && t_colors >= 16)
+	    {
+		int cterm_fg, cterm_bg;
+
+		syn_id2cterm_bg(id, &cterm_fg, &cterm_bg);
+		if (cterm_fg >= 0)
+		    fg = cterm_fg + 1;
+		if (cterm_bg >= 0)
+		    bg = cterm_bg + 1;
+	    }
+	}
+
 	/* with 8 colors set the bold attribute to get a bright foreground */
 	if (bold == TRUE)
 	    attr |= HL_BOLD;
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1360,
+/**/
     1359,
 /**/
     1358,