]> granicus.if.org Git - vim/commitdiff
patch 8.2.2508: cannot change the character displayed in non existing lines v8.2.2508
authorBram Moolenaar <Bram@vim.org>
Sat, 13 Feb 2021 17:24:23 +0000 (18:24 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 13 Feb 2021 17:24:23 +0000 (18:24 +0100)
Problem:    Cannot change the character displayed in non existing lines.
Solution:   Add the "eob" item to 'fillchars'. (closes #7832, closes #3820)

runtime/doc/options.txt
runtime/doc/todo.txt
runtime/doc/windows.txt
src/drawscreen.c
src/globals.h
src/optiondefs.h
src/screen.c
src/testdir/test_display.vim
src/version.c

index ee5ee26b451a8cfa249a2919401f60968a66a440..08d205ceff0fde778919167555cb16455906a811 100644 (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.
 
                                                *'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 short description can be found at |Q_op|.
          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 short description can be found at |Q_op|.
          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)
index a73121159ca4021d67f4ab127a1db6509696cf37..dd2ed70f656a1623b7e5d6ee45a60a51a6318e49 100644 (file)
@@ -776,8 +776,6 @@ Add something like 'fillchars' local to window, but allow for specifying a
 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)
index 2a31526e87c6edec31cac2d88be9a340b651b4a0..69de9bafe6c25d116aab7d3e568dc79cc4b10533 100644 (file)
@@ -138,10 +138,12 @@ status line is inverted anyway; you will only see this problem on terminals
 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*
index 0cddff39a49ac66f0c61898213c4eedbe07ab39d..694b9dac313bd5a0f784ba540ed846eb55f1ecf1 100644 (file)
@@ -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
index 4daa0921739886f3e5173b063ff8331ca053945c..3ad4227ebc1874b2468066b9e56436eac1375619 100644 (file)
@@ -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);
index 9961bd4771d12b85f7c476fa2fd06fb215ae4367..3e76c8ace71ec4cf13b08a436856e21905103428 100644 (file)
@@ -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,
index cd727edb825dc6989c3e5fbb1c4086db44cdc4bc..b3944a71dae7c12132f0a53183e17858a6477b52 100644 (file)
@@ -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)
index bfcb4857c02ef27a3eb8a8095f9a878ab59753b8..5bf9e5eac8806778f62e4834ada21bae2ddd7e60 100644 (file)
@@ -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:<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
index eeddd866d1e3117b728c27605285ab886da5a880..71b180f351b136dacdaa45fa4fc388bd2618c912 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2508,
 /**/
     2507,
 /**/