# HG changeset patch # User Bram Moolenaar # Date 1613237403 -3600 # Node ID 4549133c1e773eaa24801fb10fec7ebeed3a09d5 # Parent 5b37a0bf7e3a52f48ee69e60c99bac817ba3a08c patch 8.2.2508: cannot change the character displayed in non existing lines Commit: https://github.com/vim/vim/commit/a98f8a230596d8fb44cc68321de72980a21428cb Author: Bram Moolenaar Date: Sat Feb 13 18:24:23 2021 +0100 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 https://github.com/vim/vim/issues/7832, closes https://github.com/vim/vim/issues/3820) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3235,7 +3235,7 @@ A jump table for the options with a shor Only normal file name characters can be used, "/\*?[|<>" are illegal. *'fillchars'* *'fcs'* -'fillchars' 'fcs' string (default "vert:|,fold:-") +'fillchars' 'fcs' string (default "vert:|,fold:-,eob:~") global {not available when compiled without the |+folding| feature} @@ -3248,6 +3248,7 @@ A jump table for the options with a shor vert:c '|' vertical separators |:vsplit| fold:c '-' filling 'foldtext' 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 "stlnc" the space will be used when there is highlighting, '^' or '=' @@ -3267,6 +3268,7 @@ A jump table for the options with a shor vert:c VertSplit |hl-VertSplit| fold:c Folded |hl-Folded| diff:c DiffDelete |hl-DiffDelete| + eob:c EndOfBuffer |hl-EndOfBuffer| *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* 'fixendofline' 'fixeol' boolean (default on) diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -776,8 +776,6 @@ Add something like 'fillchars' local to highlight name. Esp. for the statusline. And "extends" and "precedes" are also useful without 'list' set. Also in '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. Check for PHP errors. (Wayne Davison, 2018 Oct 26) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -138,10 +138,12 @@ status line is inverted anyway; you will that have termcap codes for italics. *filler-lines* -The lines after the last buffer line in a window are called filler lines. -These lines start with a tilde (~) character. By default, these are -highlighted as NonText (|hl-NonText|). The EndOfBuffer highlight group -(|hl-EndOfBuffer|) can be used to change the highlighting of filler lines. +The lines after the last buffer line in a window are called filler lines. By +default, these lines start with a tilde (~) character. The 'eob' item in the +'fillchars' option can be used to change this character. By default, these +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* diff --git a/src/drawscreen.c b/src/drawscreen.c --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -2552,11 +2552,11 @@ win_update(win_T *wp) wp->w_botline = lnum; // 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)) win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT); 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 diff --git a/src/globals.h b/src/globals.h --- a/src/globals.h +++ b/src/globals.h @@ -1363,6 +1363,7 @@ EXTERN int fill_stlnc INIT(= ' '); EXTERN int fill_vert INIT(= ' '); EXTERN int fill_fold INIT(= '-'); EXTERN int fill_diff INIT(= '-'); +EXTERN int fill_eob INIT(= '~'); #ifdef FEAT_FOLDING EXTERN int disable_fold_update INIT(= 0); diff --git a/src/optiondefs.h b/src/optiondefs.h --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -952,7 +952,7 @@ static struct vimoption options[] = SCTX_INIT}, {"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP, (char_u *)&p_fcs, PV_NONE, - {(char_u *)"vert:|,fold:-", (char_u *)0L} + {(char_u *)"vert:|,fold:-,eob:~", (char_u *)0L} SCTX_INIT}, {"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT, (char_u *)&p_fixeol, PV_FIXEOL, diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -4765,6 +4765,7 @@ set_chars_option(char_u **varp) {&fill_vert, "vert"}, {&fill_fold, "fold"}, {&fill_diff, "diff"}, + {&fill_eob, "eob"}, }; static struct charstab lcstab[] = { @@ -4812,7 +4813,10 @@ set_chars_option(char_u **varp) lcs_tab3 = NUL; } else + { fill_diff = '-'; + fill_eob = '~'; + } } p = *varp; while (*p) diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim --- a/src/testdir/test_display.vim +++ b/src/testdir/test_display.vim @@ -257,4 +257,26 @@ func Test_display_scroll_at_topline() call StopVimInTerminal(buf) 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:', '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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2508, +/**/ 2507, /**/ 2506,