Skip to content

Commit 912fa38

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 43a100e + 662d938 commit 912fa38

File tree

7 files changed

+69
-34
lines changed

7 files changed

+69
-34
lines changed

src/normal.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9071,14 +9071,6 @@ nv_esc(cmdarg_T *cap)
90719071
static void
90729072
nv_edit(cmdarg_T *cap)
90739073
{
9074-
#ifdef FEAT_TERMINAL
9075-
if (term_in_terminal_mode())
9076-
{
9077-
term_leave_terminal_mode();
9078-
return;
9079-
}
9080-
#endif
9081-
90829074
/* <Insert> is equal to "i" */
90839075
if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS)
90849076
cap->cmdchar = 'i';
@@ -9097,6 +9089,14 @@ nv_edit(cmdarg_T *cap)
90979089
clearopbeep(cap->oap);
90989090
#endif
90999091
}
9092+
#ifdef FEAT_TERMINAL
9093+
else if (term_in_terminal_mode())
9094+
{
9095+
clearop(cap->oap);
9096+
term_leave_terminal_mode();
9097+
return;
9098+
}
9099+
#endif
91009100
else if (!curbuf->b_p_ma && !p_im)
91019101
{
91029102
/* Only give this error when 'insertmode' is off. */

src/option.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,9 @@ struct vimoption
485485
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
486486
|| defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \
487487
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
488-
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX)
489-
# 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"
488+
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX) \
489+
|| defined(FEAT_TERMINAL)
490+
# 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"
490491
#else
491492
# 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"
492493
#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);
@@ -6697,7 +6697,7 @@ win_redr_status_matches(
66976697
--first_match;
66986698
}
66996699

6700-
fillchar = fillchar_status(&attr, TRUE);
6700+
fillchar = fillchar_status(&attr, curwin);
67016701

67026702
if (first_match == 0)
67036703
{
@@ -6876,7 +6876,7 @@ win_redr_status(win_T *wp)
68766876
#endif
68776877
else
68786878
{
6879-
fillchar = fillchar_status(&attr, wp == curwin);
6879+
fillchar = fillchar_status(&attr, wp);
68806880

68816881
get_trans_bufname(wp->w_buffer);
68826882
p = NameBuff;
@@ -6973,7 +6973,7 @@ win_redr_status(win_T *wp)
69736973
if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
69746974
{
69756975
if (stl_connected(wp))
6976-
fillchar = fillchar_status(&attr, wp == curwin);
6976+
fillchar = fillchar_status(&attr, wp);
69776977
else
69786978
fillchar = fillchar_vsep(&attr);
69796979
screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
@@ -7147,7 +7147,7 @@ win_redr_custom(
71477147
else
71487148
{
71497149
row = W_WINROW(wp) + wp->w_height;
7150-
fillchar = fillchar_status(&attr, wp == curwin);
7150+
fillchar = fillchar_status(&attr, wp);
71517151
maxwidth = W_WIDTH(wp);
71527152

71537153
if (draw_ruler)
@@ -10734,10 +10734,22 @@ get_trans_bufname(buf_T *buf)
1073410734
* Get the character to use in a status line. Get its attributes in "*attr".
1073510735
*/
1073610736
static int
10737-
fillchar_status(int *attr, int is_curwin)
10737+
fillchar_status(int *attr, win_T *wp)
1073810738
{
1073910739
int fill;
10740-
if (is_curwin)
10740+
10741+
#ifdef FEAT_TERMINAL
10742+
if (bt_terminal(wp->w_buffer))
10743+
{
10744+
*attr = HL_ATTR(HLF_ST);
10745+
if (wp == curwin)
10746+
fill = fill_stl;
10747+
else
10748+
fill = fill_stlnc;
10749+
}
10750+
else
10751+
#endif
10752+
if (wp == curwin)
1074110753
{
1074210754
*attr = HL_ATTR(HLF_S);
1074310755
fill = fill_stl;
@@ -10751,10 +10763,10 @@ fillchar_status(int *attr, int is_curwin)
1075110763
* window differs, or the fillchars differ, or this is not the
1075210764
* current window */
1075310765
if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC)
10754-
|| !is_curwin || ONE_WINDOW)
10766+
|| wp != curwin || ONE_WINDOW)
1075510767
|| (fill_stl != fill_stlnc)))
1075610768
return fill;
10757-
if (is_curwin)
10769+
if (wp == curwin)
1075810770
return '^';
1075910771
return '=';
1076010772
}
@@ -10942,7 +10954,7 @@ win_redr_ruler(win_T *wp, int always)
1094210954
if (wp->w_status_height)
1094310955
{
1094410956
row = W_WINROW(wp) + wp->w_height;
10945-
fillchar = fillchar_status(&attr, wp == curwin);
10957+
fillchar = fillchar_status(&attr, wp);
1094610958
off = W_WINCOL(wp);
1094710959
width = W_WIDTH(wp);
1094810960
}

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/terminal.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
* that buffer, attributes come from the scrollback buffer tl_scrollback.
3737
*
3838
* TODO:
39+
* - Use "." for current line instead of optional.
40+
* - make row and cols one-based instead of zero-based in term_ functions.
41+
* - Add StatusLineTerm highlighting
3942
* - in bash mouse clicks are inserting characters.
4043
* - mouse scroll: when over other window, scroll that window.
4144
* - For the scrollback buffer store lines in the buffer, only attributes in
@@ -351,6 +354,8 @@ term_write_job_output(term_T *term, char_u *msg, size_t len)
351354
static void
352355
update_cursor(term_T *term, int redraw)
353356
{
357+
if (term->tl_terminal_mode)
358+
return;
354359
setcursor();
355360
if (redraw && term->tl_buffer == curbuf)
356361
{
@@ -382,14 +387,17 @@ write_to_term(buf_T *buffer, char_u *msg, channel_T *channel)
382387
ch_logn(channel, "writing %d bytes to terminal", (int)len);
383388
term_write_job_output(term, msg, len);
384389

385-
/* TODO: only update once in a while. */
386-
update_screen(0);
387-
update_cursor(term, TRUE);
390+
if (!term->tl_terminal_mode)
391+
{
392+
/* TODO: only update once in a while. */
393+
update_screen(0);
394+
update_cursor(term, TRUE);
388395
#ifdef FEAT_GUI_MACVIM
389-
/* Force a flush now for better experience of interactive shell. */
390-
if (gui.in_use)
391-
gui_macvim_force_flush();
396+
/* Force a flush now for better experience of interactive shell. */
397+
if (gui.in_use)
398+
gui_macvim_force_flush();
392399
#endif
400+
}
393401
}
394402

395403
/*
@@ -1086,7 +1094,7 @@ handle_movecursor(
10861094
if (wp->w_buffer == term->tl_buffer)
10871095
position_cursor(wp, &pos);
10881096
}
1089-
if (term->tl_buffer == curbuf)
1097+
if (term->tl_buffer == curbuf && !term->tl_terminal_mode)
10901098
{
10911099
may_toggle_cursor(term);
10921100
update_cursor(term, term->tl_cursor_visible);
@@ -2014,10 +2022,13 @@ f_term_sendkeys(typval_T *argvars, typval_T *rettv)
20142022
msg += MB_PTR2LEN(msg);
20152023
}
20162024

2017-
/* TODO: only update once in a while. */
2018-
update_screen(0);
2019-
if (buf == curbuf)
2020-
update_cursor(term, TRUE);
2025+
if (!term->tl_terminal_mode)
2026+
{
2027+
/* TODO: only update once in a while. */
2028+
update_screen(0);
2029+
if (buf == curbuf)
2030+
update_cursor(term, TRUE);
2031+
}
20212032
}
20222033

20232034
/*

src/version.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,12 @@ static char *(features[]) =
784784

785785
static int included_patches[] =
786786
{ /* Add new patch number below this line */
787+
/**/
788+
826,
789+
/**/
790+
825,
791+
/**/
792+
824,
787793
/**/
788794
823,
789795
/**/

src/vim.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,10 +1433,11 @@ typedef enum
14331433
, HLF_TP /* tabpage line */
14341434
, HLF_TPS /* tabpage line selected */
14351435
, HLF_TPF /* tabpage line filler */
1436-
, HLF_CUC /* 'cursurcolumn' */
1437-
, HLF_CUL /* 'cursurline' */
1436+
, HLF_CUC /* 'cursorcolumn' */
1437+
, HLF_CUL /* 'cursorline' */
14381438
, HLF_MC /* 'colorcolumn' */
14391439
, HLF_QFL /* quickfix window line currently selected */
1440+
, HLF_ST /* status lines of terminal windows */
14401441
, HLF_COUNT /* MUST be the last one */
14411442
} hlf_T;
14421443

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

14511452
/*
14521453
* Boolean constants

0 commit comments

Comments
 (0)