0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0825: not easy to see that a window is a terminal window

Problem:    Not easy to see that a window is a terminal window.
Solution:   Add StatusLineTerm highlighting.
This commit is contained in:
Bram Moolenaar
2017-07-31 22:29:35 +02:00
parent 392d1bfa5e
commit 3633cf5201
5 changed files with 35 additions and 15 deletions

View File

@@ -479,8 +479,9 @@ struct vimoption
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \ #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
|| defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \ || defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \
|| 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) \
# 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" || 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"
#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

@@ -165,7 +165,7 @@ static void recording_mode(int attr);
static void draw_tabline(void); static void draw_tabline(void);
#endif #endif
#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
static int fillchar_status(int *attr, int is_curwin); static int fillchar_status(int *attr, win_T *wp);
#endif #endif
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
static int fillchar_vsep(int *attr); static int fillchar_vsep(int *attr);
@@ -6686,7 +6686,7 @@ win_redr_status_matches(
--first_match; --first_match;
} }
fillchar = fillchar_status(&attr, TRUE); fillchar = fillchar_status(&attr, curwin);
if (first_match == 0) if (first_match == 0)
{ {
@@ -6865,7 +6865,7 @@ win_redr_status(win_T *wp)
#endif #endif
else else
{ {
fillchar = fillchar_status(&attr, wp == curwin); fillchar = fillchar_status(&attr, wp);
get_trans_bufname(wp->w_buffer); get_trans_bufname(wp->w_buffer);
p = NameBuff; p = NameBuff;
@@ -6962,7 +6962,7 @@ win_redr_status(win_T *wp)
if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing()) if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
{ {
if (stl_connected(wp)) if (stl_connected(wp))
fillchar = fillchar_status(&attr, wp == curwin); fillchar = fillchar_status(&attr, wp);
else else
fillchar = fillchar_vsep(&attr); fillchar = fillchar_vsep(&attr);
screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp), screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
@@ -7136,7 +7136,7 @@ win_redr_custom(
else else
{ {
row = W_WINROW(wp) + wp->w_height; row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp == curwin); fillchar = fillchar_status(&attr, wp);
maxwidth = W_WIDTH(wp); maxwidth = W_WIDTH(wp);
if (draw_ruler) if (draw_ruler)
@@ -10705,10 +10705,22 @@ get_trans_bufname(buf_T *buf)
* Get the character to use in a status line. Get its attributes in "*attr". * Get the character to use in a status line. Get its attributes in "*attr".
*/ */
static int static int
fillchar_status(int *attr, int is_curwin) fillchar_status(int *attr, win_T *wp)
{ {
int fill; int fill;
if (is_curwin)
#ifdef FEAT_TERMINAL
if (bt_terminal(wp->w_buffer))
{
*attr = HL_ATTR(HLF_ST);
if (wp == curwin)
fill = fill_stl;
else
fill = fill_stlnc;
}
else
#endif
if (wp == curwin)
{ {
*attr = HL_ATTR(HLF_S); *attr = HL_ATTR(HLF_S);
fill = fill_stl; fill = fill_stl;
@@ -10722,10 +10734,10 @@ fillchar_status(int *attr, int is_curwin)
* window differs, or the fillchars differ, or this is not the * window differs, or the fillchars differ, or this is not the
* current window */ * current window */
if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC) if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC)
|| !is_curwin || ONE_WINDOW) || wp != curwin || ONE_WINDOW)
|| (fill_stl != fill_stlnc))) || (fill_stl != fill_stlnc)))
return fill; return fill;
if (is_curwin) if (wp == curwin)
return '^'; return '^';
return '='; return '=';
} }
@@ -10913,7 +10925,7 @@ win_redr_ruler(win_T *wp, int always)
if (wp->w_status_height) if (wp->w_status_height)
{ {
row = W_WINROW(wp) + wp->w_height; row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp == curwin); fillchar = fillchar_status(&attr, wp);
off = W_WINCOL(wp); off = W_WINCOL(wp);
width = W_WIDTH(wp); width = W_WIDTH(wp);
} }

View File

@@ -6887,6 +6887,10 @@ 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",

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 */
/**/
825,
/**/ /**/
824, 824,
/**/ /**/

View File

@@ -1430,10 +1430,11 @@ typedef enum
, HLF_TP /* tabpage line */ , HLF_TP /* tabpage line */
, HLF_TPS /* tabpage line selected */ , HLF_TPS /* tabpage line selected */
, HLF_TPF /* tabpage line filler */ , HLF_TPF /* tabpage line filler */
, HLF_CUC /* 'cursurcolumn' */ , HLF_CUC /* 'cursorcolumn' */
, HLF_CUL /* 'cursurline' */ , HLF_CUL /* 'cursorline' */
, 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_COUNT /* MUST be the last one */ , HLF_COUNT /* MUST be the last one */
} hlf_T; } hlf_T;
@@ -1443,7 +1444,7 @@ 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', '$'}
/* /*
* Boolean constants * Boolean constants