Skip to content

Commit 3633cf5

Browse files
committed
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.
1 parent 392d1bf commit 3633cf5

File tree

5 files changed

+35
-15
lines changed

5 files changed

+35
-15
lines changed

src/option.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,9 @@ struct vimoption
479479
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
480480
|| defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \
481481
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
482-
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX)
483-
# 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"
482+
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \
483+
|| defined(FEAT_TERMINAL)
484+
# 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"
484485
#else
485486
# 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"
486487
#endif

src/screen.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void recording_mode(int attr);
165165
static void draw_tabline(void);
166166
#endif
167167
#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
168-
static int fillchar_status(int *attr, int is_curwin);
168+
static int fillchar_status(int *attr, win_T *wp);
169169
#endif
170170
#ifdef FEAT_WINDOWS
171171
static int fillchar_vsep(int *attr);
@@ -6686,7 +6686,7 @@ win_redr_status_matches(
66866686
--first_match;
66876687
}
66886688

6689-
fillchar = fillchar_status(&attr, TRUE);
6689+
fillchar = fillchar_status(&attr, curwin);
66906690

66916691
if (first_match == 0)
66926692
{
@@ -6865,7 +6865,7 @@ win_redr_status(win_T *wp)
68656865
#endif
68666866
else
68676867
{
6868-
fillchar = fillchar_status(&attr, wp == curwin);
6868+
fillchar = fillchar_status(&attr, wp);
68696869

68706870
get_trans_bufname(wp->w_buffer);
68716871
p = NameBuff;
@@ -6962,7 +6962,7 @@ win_redr_status(win_T *wp)
69626962
if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
69636963
{
69646964
if (stl_connected(wp))
6965-
fillchar = fillchar_status(&attr, wp == curwin);
6965+
fillchar = fillchar_status(&attr, wp);
69666966
else
69676967
fillchar = fillchar_vsep(&attr);
69686968
screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
@@ -7136,7 +7136,7 @@ win_redr_custom(
71367136
else
71377137
{
71387138
row = W_WINROW(wp) + wp->w_height;
7139-
fillchar = fillchar_status(&attr, wp == curwin);
7139+
fillchar = fillchar_status(&attr, wp);
71407140
maxwidth = W_WIDTH(wp);
71417141

71427142
if (draw_ruler)
@@ -10705,10 +10705,22 @@ get_trans_bufname(buf_T *buf)
1070510705
* Get the character to use in a status line. Get its attributes in "*attr".
1070610706
*/
1070710707
static int
10708-
fillchar_status(int *attr, int is_curwin)
10708+
fillchar_status(int *attr, win_T *wp)
1070910709
{
1071010710
int fill;
10711-
if (is_curwin)
10711+
10712+
#ifdef FEAT_TERMINAL
10713+
if (bt_terminal(wp->w_buffer))
10714+
{
10715+
*attr = HL_ATTR(HLF_ST);
10716+
if (wp == curwin)
10717+
fill = fill_stl;
10718+
else
10719+
fill = fill_stlnc;
10720+
}
10721+
else
10722+
#endif
10723+
if (wp == curwin)
1071210724
{
1071310725
*attr = HL_ATTR(HLF_S);
1071410726
fill = fill_stl;
@@ -10722,10 +10734,10 @@ fillchar_status(int *attr, int is_curwin)
1072210734
* window differs, or the fillchars differ, or this is not the
1072310735
* current window */
1072410736
if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC)
10725-
|| !is_curwin || ONE_WINDOW)
10737+
|| wp != curwin || ONE_WINDOW)
1072610738
|| (fill_stl != fill_stlnc)))
1072710739
return fill;
10728-
if (is_curwin)
10740+
if (wp == curwin)
1072910741
return '^';
1073010742
return '=';
1073110743
}
@@ -10913,7 +10925,7 @@ win_redr_ruler(win_T *wp, int always)
1091310925
if (wp->w_status_height)
1091410926
{
1091510927
row = W_WINROW(wp) + wp->w_height;
10916-
fillchar = fillchar_status(&attr, wp == curwin);
10928+
fillchar = fillchar_status(&attr, wp);
1091710929
off = W_WINCOL(wp);
1091810930
width = W_WIDTH(wp);
1091910931
}

src/syntax.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6887,6 +6887,10 @@ static char *(highlight_init_both[]) =
68876887
"StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"),
68886888
CENT("StatusLineNC term=reverse cterm=reverse",
68896889
"StatusLineNC term=reverse cterm=reverse gui=reverse"),
6890+
#ifdef FEAT_TERMINAL
6891+
CENT("StatusLineTerm term=reverse cterm=reverse ctermFg=DarkGreen",
6892+
"StatusLineTerm term=reverse cterm=reverse ctermFg=DarkGreen gui=reverse guifg=DarkGreen"),
6893+
#endif
68906894
"default link EndOfBuffer NonText",
68916895
#ifdef FEAT_WINDOWS
68926896
CENT("VertSplit term=reverse cterm=reverse",

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
825,
772774
/**/
773775
824,
774776
/**/

src/vim.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,10 +1430,11 @@ typedef enum
14301430
, HLF_TP /* tabpage line */
14311431
, HLF_TPS /* tabpage line selected */
14321432
, HLF_TPF /* tabpage line filler */
1433-
, HLF_CUC /* 'cursurcolumn' */
1434-
, HLF_CUL /* 'cursurline' */
1433+
, HLF_CUC /* 'cursorcolumn' */
1434+
, HLF_CUL /* 'cursorline' */
14351435
, HLF_MC /* 'colorcolumn' */
14361436
, HLF_QFL /* quickfix window line currently selected */
1437+
, HLF_ST /* status lines of terminal windows */
14371438
, HLF_COUNT /* MUST be the last one */
14381439
} hlf_T;
14391440

@@ -1443,7 +1444,7 @@ typedef enum
14431444
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
14441445
'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \
14451446
'B', 'P', 'R', 'L', \
1446-
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q'}
1447+
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '$'}
14471448

14481449
/*
14491450
* Boolean constants

0 commit comments

Comments
 (0)