]> granicus.if.org Git - vim/commitdiff
patch 8.0.1600: crash when setting t_Co to zero when 'termguicolors' is set v8.0.1600
authorBram Moolenaar <Bram@vim.org>
Mon, 12 Mar 2018 20:48:32 +0000 (21:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 12 Mar 2018 20:48:32 +0000 (21:48 +0100)
Problem:    Crash when setting t_Co to zero when 'termguicolors' is set.
Solution:   Use IS_CTERM instead of checking the number of colors.
            (closes #2710)

src/screen.c
src/testdir/test_highlight.vim
src/version.c

index 5ab2e85fc8109e04181664da7cbd5ac2e3247dbb..77a3c1895fb4883a407285b06489450d7aa8bc7d 100644 (file)
@@ -8127,7 +8127,7 @@ screen_start_highlight(int attr)
                        term_bg_color(aep->ae_u.cterm.bg_color - 1);
                }
 
-               if (t_colors <= 1)
+               if (!IS_CTERM)
                {
                    if (aep->ae_u.term.start != NULL)
                        out_str(aep->ae_u.term.start);
index f3d7d0f2a000e4077d480a82780339221339c672..0c4be7bf39043455e5eee71243a264ecf47321ed 100644 (file)
@@ -514,3 +514,17 @@ func Test_highlight_eol_on_diff()
   bwipe!
   diffoff
 endfunc
+
+func Test_termguicolors()
+  if !exists('+termguicolors')
+    return
+  endif
+
+  " Basic test that setting 'termguicolors' works with one color.
+  set termguicolors
+  redraw
+  set t_Co=1
+  redraw
+  set t_Co=0
+  redraw
+endfunc
index eabf6fb3105af0c802abc50f7c91a1e97967ce0a..23b0168101e3721bcaf1a3b9e6c2d3af5803d12a 100644 (file)
@@ -766,6 +766,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1600,
 /**/
     1599,
 /**/