Skip to content

Commit f708ac5

Browse files
committed
patch 8.0.1600: crash when setting t_Co to zero when 'termguicolors' is set
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)
1 parent 3e4b84d commit f708ac5

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/screen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8127,7 +8127,7 @@ screen_start_highlight(int attr)
81278127
term_bg_color(aep->ae_u.cterm.bg_color - 1);
81288128
}
81298129

8130-
if (t_colors <= 1)
8130+
if (!IS_CTERM)
81318131
{
81328132
if (aep->ae_u.term.start != NULL)
81338133
out_str(aep->ae_u.term.start);

src/testdir/test_highlight.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,3 +514,17 @@ func Test_highlight_eol_on_diff()
514514
bwipe!
515515
diffoff
516516
endfunc
517+
518+
func Test_termguicolors()
519+
if !exists('+termguicolors')
520+
return
521+
endif
522+
523+
" Basic test that setting 'termguicolors' works with one color.
524+
set termguicolors
525+
redraw
526+
set t_Co=1
527+
redraw
528+
set t_Co=0
529+
redraw
530+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ static char *(features[]) =
766766

767767
static int included_patches[] =
768768
{ /* Add new patch number below this line */
769+
/**/
770+
1600,
769771
/**/
770772
1599,
771773
/**/

0 commit comments

Comments
 (0)