0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2508: cannot change the character displayed in non existing lines

Problem:    Cannot change the character displayed in non existing lines.
Solution:   Add the "eob" item to 'fillchars'. (closes #7832, closes #3820)
This commit is contained in:
Bram Moolenaar
2021-02-13 18:24:23 +01:00
parent 942db23c9c
commit a98f8a2305
9 changed files with 41 additions and 10 deletions

View File

@@ -3235,7 +3235,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Only normal file name characters can be used, "/\*?[|<>" are illegal. Only normal file name characters can be used, "/\*?[|<>" are illegal.
*'fillchars'* *'fcs'* *'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "vert:|,fold:-") 'fillchars' 'fcs' string (default "vert:|,fold:-,eob:~")
global global
{not available when compiled without the |+folding| {not available when compiled without the |+folding|
feature} feature}
@@ -3248,6 +3248,7 @@ A jump table for the options with a short description can be found at |Q_op|.
vert:c '|' vertical separators |:vsplit| vert:c '|' vertical separators |:vsplit|
fold:c '-' filling 'foldtext' fold:c '-' filling 'foldtext'
diff:c '-' deleted lines of the 'diff' option diff:c '-' deleted lines of the 'diff' option
eob:c '~' empty lines below the end of a buffer
Any one that is omitted will fall back to the default. For "stl" and Any one that is omitted will fall back to the default. For "stl" and
"stlnc" the space will be used when there is highlighting, '^' or '=' "stlnc" the space will be used when there is highlighting, '^' or '='
@@ -3267,6 +3268,7 @@ A jump table for the options with a short description can be found at |Q_op|.
vert:c VertSplit |hl-VertSplit| vert:c VertSplit |hl-VertSplit|
fold:c Folded |hl-Folded| fold:c Folded |hl-Folded|
diff:c DiffDelete |hl-DiffDelete| diff:c DiffDelete |hl-DiffDelete|
eob:c EndOfBuffer |hl-EndOfBuffer|
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
'fixendofline' 'fixeol' boolean (default on) 'fixendofline' 'fixeol' boolean (default on)

View File

@@ -776,8 +776,6 @@ Add something like 'fillchars' local to window, but allow for specifying a
highlight name. Esp. for the statusline. highlight name. Esp. for the statusline.
And "extends" and "precedes" are also useful without 'list' set. Also in And "extends" and "precedes" are also useful without 'list' set. Also in
'fillchars' or another option? 'fillchars' or another option?
Related: #3820 - Support setting the character displayed below the last line?
Neovim uses "eob:X" in 'fillchars'.
Sourceforge Vim pages still have content, redirect from empty page. Sourceforge Vim pages still have content, redirect from empty page.
Check for PHP errors. (Wayne Davison, 2018 Oct 26) Check for PHP errors. (Wayne Davison, 2018 Oct 26)

View File

@@ -138,10 +138,12 @@ status line is inverted anyway; you will only see this problem on terminals
that have termcap codes for italics. that have termcap codes for italics.
*filler-lines* *filler-lines*
The lines after the last buffer line in a window are called filler lines. The lines after the last buffer line in a window are called filler lines. By
These lines start with a tilde (~) character. By default, these are default, these lines start with a tilde (~) character. The 'eob' item in the
highlighted as NonText (|hl-NonText|). The EndOfBuffer highlight group 'fillchars' option can be used to change this character. By default, these
(|hl-EndOfBuffer|) can be used to change the highlighting of filler lines. characters are highlighted as NonText (|hl-NonText|). The EndOfBuffer
highlight group (|hl-EndOfBuffer|) can be used to change the highlighting of
the filler characters.
============================================================================== ==============================================================================
3. Opening and closing a window *opening-window* *E36* 3. Opening and closing a window *opening-window* *E36*

View File

@@ -2552,11 +2552,11 @@ win_update(win_T *wp)
wp->w_botline = lnum; wp->w_botline = lnum;
// Make sure the rest of the screen is blank // Make sure the rest of the screen is blank
// put '~'s on rows that aren't part of the file. // write the 'fill_eob' character to rows that aren't part of the file
if (WIN_IS_POPUP(wp)) if (WIN_IS_POPUP(wp))
win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT); win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT);
else else
win_draw_end(wp, '~', ' ', FALSE, row, wp->w_height, HLF_EOB); win_draw_end(wp, fill_eob, ' ', FALSE, row, wp->w_height, HLF_EOB);
} }
#ifdef SYN_TIME_LIMIT #ifdef SYN_TIME_LIMIT

View File

@@ -1363,6 +1363,7 @@ EXTERN int fill_stlnc INIT(= ' ');
EXTERN int fill_vert INIT(= ' '); EXTERN int fill_vert INIT(= ' ');
EXTERN int fill_fold INIT(= '-'); EXTERN int fill_fold INIT(= '-');
EXTERN int fill_diff INIT(= '-'); EXTERN int fill_diff INIT(= '-');
EXTERN int fill_eob INIT(= '~');
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
EXTERN int disable_fold_update INIT(= 0); EXTERN int disable_fold_update INIT(= 0);

View File

@@ -952,7 +952,7 @@ static struct vimoption options[] =
SCTX_INIT}, SCTX_INIT},
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
(char_u *)&p_fcs, PV_NONE, (char_u *)&p_fcs, PV_NONE,
{(char_u *)"vert:|,fold:-", (char_u *)0L} {(char_u *)"vert:|,fold:-,eob:~", (char_u *)0L}
SCTX_INIT}, SCTX_INIT},
{"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT, {"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT,
(char_u *)&p_fixeol, PV_FIXEOL, (char_u *)&p_fixeol, PV_FIXEOL,

View File

@@ -4765,6 +4765,7 @@ set_chars_option(char_u **varp)
{&fill_vert, "vert"}, {&fill_vert, "vert"},
{&fill_fold, "fold"}, {&fill_fold, "fold"},
{&fill_diff, "diff"}, {&fill_diff, "diff"},
{&fill_eob, "eob"},
}; };
static struct charstab lcstab[] = static struct charstab lcstab[] =
{ {
@@ -4812,7 +4813,10 @@ set_chars_option(char_u **varp)
lcs_tab3 = NUL; lcs_tab3 = NUL;
} }
else else
{
fill_diff = '-'; fill_diff = '-';
fill_eob = '~';
}
} }
p = *varp; p = *varp;
while (*p) while (*p)

View File

@@ -257,4 +257,26 @@ func Test_display_scroll_at_topline()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc
" Test for 'eob' (EndOfBuffer) item in 'fillchars'
func Test_eob_fillchars()
" default value
call assert_match('eob:\~', &fillchars)
" invalid values
call assert_fails(':set fillchars=eob:', 'E474:')
call assert_fails(':set fillchars=eob:xy', 'E474:')
call assert_fails(':set fillchars=eob:\255', 'E474:')
call assert_fails(':set fillchars=eob:<ff>', 'E474:')
" default is ~
new
call assert_equal('~', Screenline(2))
set fillchars=eob:+
redraw!
call assert_equal('+', Screenline(2))
set fillchars=eob:\
redraw!
call assert_equal(' ', nr2char(screenchar(2, 1)))
set fillchars&
close
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -750,6 +750,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 */
/**/
2508,
/**/ /**/
2507, 2507,
/**/ /**/