Skip to content

Commit a98f8a2

Browse files
committed
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)
1 parent 942db23 commit a98f8a2

File tree

9 files changed

+41
-10
lines changed

9 files changed

+41
-10
lines changed

runtime/doc/options.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ A jump table for the options with a short description can be found at |Q_op|.
32353235
Only normal file name characters can be used, "/\*?[|<>" are illegal.
32363236

32373237
*'fillchars'* *'fcs'*
3238-
'fillchars' 'fcs' string (default "vert:|,fold:-")
3238+
'fillchars' 'fcs' string (default "vert:|,fold:-,eob:~")
32393239
global
32403240
{not available when compiled without the |+folding|
32413241
feature}
@@ -3248,6 +3248,7 @@ A jump table for the options with a short description can be found at |Q_op|.
32483248
vert:c '|' vertical separators |:vsplit|
32493249
fold:c '-' filling 'foldtext'
32503250
diff:c '-' deleted lines of the 'diff' option
3251+
eob:c '~' empty lines below the end of a buffer
32513252

32523253
Any one that is omitted will fall back to the default. For "stl" and
32533254
"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|.
32673268
vert:c VertSplit |hl-VertSplit|
32683269
fold:c Folded |hl-Folded|
32693270
diff:c DiffDelete |hl-DiffDelete|
3271+
eob:c EndOfBuffer |hl-EndOfBuffer|
32703272

32713273
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
32723274
'fixendofline' 'fixeol' boolean (default on)

runtime/doc/todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,6 @@ Add something like 'fillchars' local to window, but allow for specifying a
776776
highlight name. Esp. for the statusline.
777777
And "extends" and "precedes" are also useful without 'list' set. Also in
778778
'fillchars' or another option?
779-
Related: #3820 - Support setting the character displayed below the last line?
780-
Neovim uses "eob:X" in 'fillchars'.
781779

782780
Sourceforge Vim pages still have content, redirect from empty page.
783781
Check for PHP errors. (Wayne Davison, 2018 Oct 26)

runtime/doc/windows.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ status line is inverted anyway; you will only see this problem on terminals
138138
that have termcap codes for italics.
139139

140140
*filler-lines*
141-
The lines after the last buffer line in a window are called filler lines.
142-
These lines start with a tilde (~) character. By default, these are
143-
highlighted as NonText (|hl-NonText|). The EndOfBuffer highlight group
144-
(|hl-EndOfBuffer|) can be used to change the highlighting of filler lines.
141+
The lines after the last buffer line in a window are called filler lines. By
142+
default, these lines start with a tilde (~) character. The 'eob' item in the
143+
'fillchars' option can be used to change this character. By default, these
144+
characters are highlighted as NonText (|hl-NonText|). The EndOfBuffer
145+
highlight group (|hl-EndOfBuffer|) can be used to change the highlighting of
146+
the filler characters.
145147

146148
==============================================================================
147149
3. Opening and closing a window *opening-window* *E36*

src/drawscreen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,11 +2552,11 @@ win_update(win_T *wp)
25522552
wp->w_botline = lnum;
25532553

25542554
// Make sure the rest of the screen is blank
2555-
// put '~'s on rows that aren't part of the file.
2555+
// write the 'fill_eob' character to rows that aren't part of the file
25562556
if (WIN_IS_POPUP(wp))
25572557
win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT);
25582558
else
2559-
win_draw_end(wp, '~', ' ', FALSE, row, wp->w_height, HLF_EOB);
2559+
win_draw_end(wp, fill_eob, ' ', FALSE, row, wp->w_height, HLF_EOB);
25602560
}
25612561

25622562
#ifdef SYN_TIME_LIMIT

src/globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,7 @@ EXTERN int fill_stlnc INIT(= ' ');
13631363
EXTERN int fill_vert INIT(= ' ');
13641364
EXTERN int fill_fold INIT(= '-');
13651365
EXTERN int fill_diff INIT(= '-');
1366+
EXTERN int fill_eob INIT(= '~');
13661367

13671368
#ifdef FEAT_FOLDING
13681369
EXTERN int disable_fold_update INIT(= 0);

src/optiondefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ static struct vimoption options[] =
952952
SCTX_INIT},
953953
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
954954
(char_u *)&p_fcs, PV_NONE,
955-
{(char_u *)"vert:|,fold:-", (char_u *)0L}
955+
{(char_u *)"vert:|,fold:-,eob:~", (char_u *)0L}
956956
SCTX_INIT},
957957
{"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT,
958958
(char_u *)&p_fixeol, PV_FIXEOL,

src/screen.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,6 +4765,7 @@ set_chars_option(char_u **varp)
47654765
{&fill_vert, "vert"},
47664766
{&fill_fold, "fold"},
47674767
{&fill_diff, "diff"},
4768+
{&fill_eob, "eob"},
47684769
};
47694770
static struct charstab lcstab[] =
47704771
{
@@ -4812,7 +4813,10 @@ set_chars_option(char_u **varp)
48124813
lcs_tab3 = NUL;
48134814
}
48144815
else
4816+
{
48154817
fill_diff = '-';
4818+
fill_eob = '~';
4819+
}
48164820
}
48174821
p = *varp;
48184822
while (*p)

src/testdir/test_display.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,26 @@ func Test_display_scroll_at_topline()
257257
call StopVimInTerminal(buf)
258258
endfunc
259259

260+
" Test for 'eob' (EndOfBuffer) item in 'fillchars'
261+
func Test_eob_fillchars()
262+
" default value
263+
call assert_match('eob:\~', &fillchars)
264+
" invalid values
265+
call assert_fails(':set fillchars=eob:', 'E474:')
266+
call assert_fails(':set fillchars=eob:xy', 'E474:')
267+
call assert_fails(':set fillchars=eob:\255', 'E474:')
268+
call assert_fails(':set fillchars=eob:<ff>', 'E474:')
269+
" default is ~
270+
new
271+
call assert_equal('~', Screenline(2))
272+
set fillchars=eob:+
273+
redraw!
274+
call assert_equal('+', Screenline(2))
275+
set fillchars=eob:\
276+
redraw!
277+
call assert_equal(' ', nr2char(screenchar(2, 1)))
278+
set fillchars&
279+
close
280+
endfunc
281+
260282
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2508,
753755
/**/
754756
2507,
755757
/**/

0 commit comments

Comments
 (0)