patch 8.0.0941: existing color schemes don't like StatusLineTerm

Problem:    Existing color schemes don't work well with StatusLineTerm.
Solution:   Don't use "reverse", use fg and bg colors.  Also add
            StatusLineTermNC.
This commit is contained in:
Bram Moolenaar
2017-08-14 22:35:08 +02:00
parent c08706135d
commit 05fbfdcda4
6 changed files with 200 additions and 173 deletions

View File

@@ -364,6 +364,7 @@ EXTERN int highlight_user[9]; /* User[1-9] attributes */
EXTERN int highlight_stlnc[9]; /* On top of user */ EXTERN int highlight_stlnc[9]; /* On top of user */
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
EXTERN int highlight_stlterm[9]; /* On top of user */ EXTERN int highlight_stlterm[9]; /* On top of user */
EXTERN int highlight_stltermnc[9]; /* On top of user */
# endif # endif
# endif # endif
#endif #endif

View File

@@ -481,7 +481,7 @@ struct vimoption
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \ || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \ || defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \
|| defined(FEAT_TERMINAL) || defined(FEAT_TERMINAL)
# define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,$:StatusLineTerm" # define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC"
#else #else
# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" # define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
#endif #endif

View File

@@ -7258,6 +7258,9 @@ win_redr_custom(
curattr = syn_id2attr(-hltab[n].userhl); curattr = syn_id2attr(-hltab[n].userhl);
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer)
&& wp->w_status_height != 0)
curattr = highlight_stltermnc[hltab[n].userhl - 1];
else if (wp != NULL && bt_terminal(wp->w_buffer) else if (wp != NULL && bt_terminal(wp->w_buffer)
&& wp->w_status_height != 0) && wp->w_status_height != 0)
curattr = highlight_stlterm[hltab[n].userhl - 1]; curattr = highlight_stlterm[hltab[n].userhl - 1];
@@ -10724,12 +10727,17 @@ fillchar_status(int *attr, win_T *wp)
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
if (bt_terminal(wp->w_buffer)) if (bt_terminal(wp->w_buffer))
{ {
*attr = HL_ATTR(HLF_ST);
if (wp == curwin) if (wp == curwin)
{
*attr = HL_ATTR(HLF_ST);
fill = fill_stl; fill = fill_stl;
}
else else
{
*attr = HL_ATTR(HLF_STNC);
fill = fill_stlnc; fill = fill_stlnc;
} }
}
else else
#endif #endif
if (wp == curwin) if (wp == curwin)

View File

@@ -6873,8 +6873,7 @@ syntime_report(void)
#else #else
# define CENT(a, b) a # define CENT(a, b) a
#endif #endif
static char *(highlight_init_both[]) = static char *(highlight_init_both[]) = {
{
CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White", CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White",
"ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"), "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"),
CENT("IncSearch term=reverse cterm=reverse", CENT("IncSearch term=reverse cterm=reverse",
@@ -6887,10 +6886,6 @@ static char *(highlight_init_both[]) =
"StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"), "StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"),
CENT("StatusLineNC term=reverse cterm=reverse", CENT("StatusLineNC term=reverse cterm=reverse",
"StatusLineNC term=reverse cterm=reverse gui=reverse"), "StatusLineNC term=reverse cterm=reverse gui=reverse"),
#ifdef FEAT_TERMINAL
CENT("StatusLineTerm term=reverse cterm=reverse ctermFg=DarkGreen",
"StatusLineTerm term=reverse cterm=reverse ctermFg=DarkGreen gui=reverse guifg=DarkGreen"),
#endif
"default link EndOfBuffer NonText", "default link EndOfBuffer NonText",
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
CENT("VertSplit term=reverse cterm=reverse", CENT("VertSplit term=reverse cterm=reverse",
@@ -6920,10 +6915,10 @@ static char *(highlight_init_both[]) =
#endif #endif
"default link QuickFixLine Search", "default link QuickFixLine Search",
NULL NULL
}; };
static char *(highlight_init_light[]) = /* Default colors only used with a light background. */
{ static char *(highlight_init_light[]) = {
CENT("Directory term=bold ctermfg=DarkBlue", CENT("Directory term=bold ctermfg=DarkBlue",
"Directory term=bold ctermfg=DarkBlue guifg=Blue"), "Directory term=bold ctermfg=DarkBlue guifg=Blue"),
CENT("LineNr term=underline ctermfg=Brown", CENT("LineNr term=underline ctermfg=Brown",
@@ -7006,12 +7001,18 @@ static char *(highlight_init_light[]) =
#endif #endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
"Normal gui=NONE", "Normal gui=NONE",
#endif
#ifdef FEAT_TERMINAL
CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen",
"StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen gui=bold guifg=bg guibg=DarkGreen"),
CENT("StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen",
"StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen guifg=bg guibg=DarkGreen"),
#endif #endif
NULL NULL
}; };
static char *(highlight_init_dark[]) = /* Default colors only used with a dark background. */
{ static char *(highlight_init_dark[]) = {
CENT("Directory term=bold ctermfg=LightCyan", CENT("Directory term=bold ctermfg=LightCyan",
"Directory term=bold ctermfg=LightCyan guifg=Cyan"), "Directory term=bold ctermfg=LightCyan guifg=Cyan"),
CENT("LineNr term=underline ctermfg=Yellow", CENT("LineNr term=underline ctermfg=Yellow",
@@ -7094,9 +7095,15 @@ static char *(highlight_init_dark[]) =
#endif #endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
"Normal gui=NONE", "Normal gui=NONE",
#endif
#ifdef FEAT_TERMINAL
CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen",
"StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen gui=bold guifg=bg guibg=LightGreen"),
CENT("StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen",
"StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen guifg=bg guibg=LightGreen"),
#endif #endif
NULL NULL
}; };
void void
init_highlight( init_highlight(
@@ -9788,7 +9795,7 @@ gui_do_one_color(
#if defined(USER_HIGHLIGHT) && defined(FEAT_STL_OPT) #if defined(USER_HIGHLIGHT) && defined(FEAT_STL_OPT)
/* /*
* Apply difference between User[1-9] and HLF_S to HLF_SNC or HLF_ST. * Apply difference between User[1-9] and HLF_S to HLF_SNC, HLF_ST or HLF_STNC.
*/ */
static void static void
combine_stl_hlt( combine_stl_hlt(
@@ -9877,6 +9884,7 @@ highlight_changed(void)
int id_S = -1; int id_S = -1;
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
int id_ST = -1; int id_ST = -1;
int id_STNC = -1;
# endif # endif
int hlcnt; int hlcnt;
# endif # endif
@@ -9960,6 +9968,8 @@ highlight_changed(void)
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
else if (hlf == (int)HLF_ST) else if (hlf == (int)HLF_ST)
id_ST = syn_get_final_id(id); id_ST = syn_get_final_id(id);
else if (hlf == (int)HLF_STNC)
id_STNC = syn_get_final_id(id);
# endif # endif
else if (hlf == (int)HLF_S) else if (hlf == (int)HLF_S)
id_S = syn_get_final_id(id); id_S = syn_get_final_id(id);
@@ -9977,22 +9987,23 @@ highlight_changed(void)
#ifdef USER_HIGHLIGHT #ifdef USER_HIGHLIGHT
/* Setup the user highlights /* Setup the user highlights
* *
* Temporarily utilize 19 more hl entries: * Temporarily utilize 28 more hl entries:
* 9 for User1-User9 combined with StatusLineNC * 9 for User1-User9 combined with StatusLineNC
* 9 for User1-User9 combined with StatusLineTerm * 9 for User1-User9 combined with StatusLineTerm
* 9 for User1-User9 combined with StatusLineTermNC
* 1 for StatusLine default * 1 for StatusLine default
* Have to be in there simultaneously in case of table overflows in * Have to be in there simultaneously in case of table overflows in
* get_attr_entry() * get_attr_entry()
*/ */
# ifdef FEAT_STL_OPT # ifdef FEAT_STL_OPT
if (ga_grow(&highlight_ga, 19) == FAIL) if (ga_grow(&highlight_ga, 28) == FAIL)
return FAIL; return FAIL;
hlcnt = highlight_ga.ga_len; hlcnt = highlight_ga.ga_len;
if (id_S == 0) if (id_S == 0)
{ {
/* Make sure id_S is always valid to simplify code below. Use the last /* Make sure id_S is always valid to simplify code below. Use the last
* entry. */ * entry. */
vim_memset(&HL_TABLE()[hlcnt + 18], 0, sizeof(struct hl_group)); vim_memset(&HL_TABLE()[hlcnt + 27], 0, sizeof(struct hl_group));
HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S]; HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S];
id_S = hlcnt + 19; id_S = hlcnt + 19;
} }
@@ -10008,6 +10019,7 @@ highlight_changed(void)
highlight_stlnc[i] = 0; highlight_stlnc[i] = 0;
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
highlight_stlterm[i] = 0; highlight_stlterm[i] = 0;
highlight_stltermnc[i] = 0;
# endif # endif
# endif # endif
} }
@@ -10020,6 +10032,8 @@ highlight_changed(void)
# ifdef FEAT_TERMINAL # ifdef FEAT_TERMINAL
combine_stl_hlt(id, id_S, id_ST, hlcnt + 9, i, combine_stl_hlt(id, id_S, id_ST, hlcnt + 9, i,
HLF_ST, highlight_stlterm); HLF_ST, highlight_stlterm);
combine_stl_hlt(id, id_S, id_STNC, hlcnt + 18, i,
HLF_STNC, highlight_stltermnc);
# endif # endif
# endif # endif
} }

View File

@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
941,
/**/ /**/
940, 940,
/**/ /**/

View File

@@ -1437,6 +1437,7 @@ typedef enum
, HLF_MC /* 'colorcolumn' */ , HLF_MC /* 'colorcolumn' */
, HLF_QFL /* quickfix window line currently selected */ , HLF_QFL /* quickfix window line currently selected */
, HLF_ST /* status lines of terminal windows */ , HLF_ST /* status lines of terminal windows */
, HLF_STNC /* status lines of not-current terminal windows */
, HLF_COUNT /* MUST be the last one */ , HLF_COUNT /* MUST be the last one */
} hlf_T; } hlf_T;
@@ -1446,7 +1447,8 @@ typedef enum
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ 'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \
'B', 'P', 'R', 'L', \ 'B', 'P', 'R', 'L', \
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '$'} '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', \
'z', 'Z'}
/* /*
* Boolean constants * Boolean constants