mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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:
@@ -364,6 +364,7 @@ EXTERN int highlight_user[9]; /* User[1-9] attributes */
|
||||
EXTERN int highlight_stlnc[9]; /* On top of user */
|
||||
# ifdef FEAT_TERMINAL
|
||||
EXTERN int highlight_stlterm[9]; /* On top of user */
|
||||
EXTERN int highlight_stltermnc[9]; /* On top of user */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
@@ -481,7 +481,7 @@ struct vimoption
|
||||
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
|
||||
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \
|
||||
|| 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
|
||||
# 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
|
||||
|
10
src/screen.c
10
src/screen.c
@@ -7258,6 +7258,9 @@ win_redr_custom(
|
||||
curattr = syn_id2attr(-hltab[n].userhl);
|
||||
#ifdef FEAT_WINDOWS
|
||||
# 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)
|
||||
&& wp->w_status_height != 0)
|
||||
curattr = highlight_stlterm[hltab[n].userhl - 1];
|
||||
@@ -10724,12 +10727,17 @@ fillchar_status(int *attr, win_T *wp)
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (bt_terminal(wp->w_buffer))
|
||||
{
|
||||
*attr = HL_ATTR(HLF_ST);
|
||||
if (wp == curwin)
|
||||
{
|
||||
*attr = HL_ATTR(HLF_ST);
|
||||
fill = fill_stl;
|
||||
}
|
||||
else
|
||||
{
|
||||
*attr = HL_ATTR(HLF_STNC);
|
||||
fill = fill_stlnc;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (wp == curwin)
|
||||
|
48
src/syntax.c
48
src/syntax.c
@@ -6873,8 +6873,7 @@ syntime_report(void)
|
||||
#else
|
||||
# define CENT(a, b) a
|
||||
#endif
|
||||
static char *(highlight_init_both[]) =
|
||||
{
|
||||
static char *(highlight_init_both[]) = {
|
||||
CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White",
|
||||
"ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"),
|
||||
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"),
|
||||
CENT("StatusLineNC term=reverse cterm=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",
|
||||
#ifdef FEAT_WINDOWS
|
||||
CENT("VertSplit term=reverse cterm=reverse",
|
||||
@@ -6920,10 +6915,10 @@ static char *(highlight_init_both[]) =
|
||||
#endif
|
||||
"default link QuickFixLine Search",
|
||||
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",
|
||||
"Directory term=bold ctermfg=DarkBlue guifg=Blue"),
|
||||
CENT("LineNr term=underline ctermfg=Brown",
|
||||
@@ -7006,12 +7001,18 @@ static char *(highlight_init_light[]) =
|
||||
#endif
|
||||
#ifdef FEAT_GUI
|
||||
"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
|
||||
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",
|
||||
"Directory term=bold ctermfg=LightCyan guifg=Cyan"),
|
||||
CENT("LineNr term=underline ctermfg=Yellow",
|
||||
@@ -7094,9 +7095,15 @@ static char *(highlight_init_dark[]) =
|
||||
#endif
|
||||
#ifdef FEAT_GUI
|
||||
"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
|
||||
NULL
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
init_highlight(
|
||||
@@ -9788,7 +9795,7 @@ gui_do_one_color(
|
||||
|
||||
#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
|
||||
combine_stl_hlt(
|
||||
@@ -9877,6 +9884,7 @@ highlight_changed(void)
|
||||
int id_S = -1;
|
||||
# ifdef FEAT_TERMINAL
|
||||
int id_ST = -1;
|
||||
int id_STNC = -1;
|
||||
# endif
|
||||
int hlcnt;
|
||||
# endif
|
||||
@@ -9960,6 +9968,8 @@ highlight_changed(void)
|
||||
# ifdef FEAT_TERMINAL
|
||||
else if (hlf == (int)HLF_ST)
|
||||
id_ST = syn_get_final_id(id);
|
||||
else if (hlf == (int)HLF_STNC)
|
||||
id_STNC = syn_get_final_id(id);
|
||||
# endif
|
||||
else if (hlf == (int)HLF_S)
|
||||
id_S = syn_get_final_id(id);
|
||||
@@ -9977,22 +9987,23 @@ highlight_changed(void)
|
||||
#ifdef USER_HIGHLIGHT
|
||||
/* 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 StatusLineTerm
|
||||
* 9 for User1-User9 combined with StatusLineTermNC
|
||||
* 1 for StatusLine default
|
||||
* Have to be in there simultaneously in case of table overflows in
|
||||
* get_attr_entry()
|
||||
*/
|
||||
# ifdef FEAT_STL_OPT
|
||||
if (ga_grow(&highlight_ga, 19) == FAIL)
|
||||
if (ga_grow(&highlight_ga, 28) == FAIL)
|
||||
return FAIL;
|
||||
hlcnt = highlight_ga.ga_len;
|
||||
if (id_S == 0)
|
||||
{
|
||||
/* Make sure id_S is always valid to simplify code below. Use the last
|
||||
* 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];
|
||||
id_S = hlcnt + 19;
|
||||
}
|
||||
@@ -10008,6 +10019,7 @@ highlight_changed(void)
|
||||
highlight_stlnc[i] = 0;
|
||||
# ifdef FEAT_TERMINAL
|
||||
highlight_stlterm[i] = 0;
|
||||
highlight_stltermnc[i] = 0;
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
@@ -10020,6 +10032,8 @@ highlight_changed(void)
|
||||
# ifdef FEAT_TERMINAL
|
||||
combine_stl_hlt(id, id_S, id_ST, hlcnt + 9, i,
|
||||
HLF_ST, highlight_stlterm);
|
||||
combine_stl_hlt(id, id_S, id_STNC, hlcnt + 18, i,
|
||||
HLF_STNC, highlight_stltermnc);
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
941,
|
||||
/**/
|
||||
940,
|
||||
/**/
|
||||
|
@@ -1437,6 +1437,7 @@ typedef enum
|
||||
, HLF_MC /* 'colorcolumn' */
|
||||
, HLF_QFL /* quickfix window line currently selected */
|
||||
, HLF_ST /* status lines of terminal windows */
|
||||
, HLF_STNC /* status lines of not-current terminal windows */
|
||||
, HLF_COUNT /* MUST be the last one */
|
||||
} hlf_T;
|
||||
|
||||
@@ -1446,7 +1447,8 @@ typedef enum
|
||||
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
|
||||
'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \
|
||||
'B', 'P', 'R', 'L', \
|
||||
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '$'}
|
||||
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', \
|
||||
'z', 'Z'}
|
||||
|
||||
/*
|
||||
* Boolean constants
|
||||
|
Reference in New Issue
Block a user