-------------------------------------------- On Mon, 12/12/16, maximabrowning via vim_dev <[email protected]> wrote:
Subject: Re: stl, stlnc of fillchars are not always applied, depends on difference between StatusLine and StatusLineNC To: [email protected] Date: Monday, December 12, 2016, 2:49 AM -------------------------------------------- On Mon, 12/12/16, itchyny <[email protected]> wrote: Subject: Re: stl, stlnc of fillchars are not always applied, depends on difference between StatusLine and StatusLineNC To: "vim_dev" <[email protected]> Cc: [email protected] Date: Monday, December 12, 2016, 2:13 AM On Monday, December 12, 2016 at 2:28:51 AM UTC+9, Bram Moolenaar wrote: > Ken Hamada wrote: > > > Hi list. I found a strange behavior of fillchars and StatusLine. > > > > vim -u NONE --cmd 'set fillchars=stl:\ ,stlnc:\ ' --cmd 'vnew' > > I set both stl and stlnc space so that I don't see any ^ or = characters in the statusline. > > But when I set the following highlights, Vim draws the statusline of the current window with ^. > > > > hi StatusLine ctermbg=8 ctermfg=7 cterm=NONE guibg=NONE guifg=NONE gui=NONE > > hi StatusLineNC ctermbg=8 ctermfg=7 cterm=NONE guibg=NONE guifg=NONE gui=NONE > > > > I set both spaces in fillchars so I expect them applied regardless of highlight configurations. > > Setting ctermfg=15 for StatusLine (I mean, make differences between the highlights), > > Vim respects the value of fillchars again. > > > > Apparently this behavior comes from https://github.com/vim/vim/blob/4c8980b717f73042f1d625ee255fa74eddb989ba/src/screen.c#L10535-L10540. > > When stl and stlnc are same and StatusLine and StatusLineNC are same, the fill characters falls back to the defaults. > > The help only mentions the case when there is highlighting or not. > > The current behavior is not intuitive to me. > > > > diff --git a/src/screen.c b/src/screen.c > > index ee61a01..17f72cd 100644 > > --- a/src/screen.c > > +++ b/src/screen.c > > @@ -10532,12 +10532,8 @@ fillchar_status(int *attr, int is_curwin) > > *attr = hl_attr(HLF_SNC); > > fill = fill_stlnc; > > } > > - /* Use fill when there is highlighting, and highlighting of current > > - * window differs, or the fillchars differ, or this is not the > > - * current window */ > > - if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC) > > - || !is_curwin || ONE_WINDOW) > > - || (fill_stl != fill_stlnc))) > > + /* Use fill when there is highlighting. */ > > + if (*attr != 0) > > return fill; > > if (is_curwin) > > return '^'; > > > > > > What do you think? > > The problem is that the default is that both fill characters are a > space. I think the best would be to check if the 'fillchar' option > specifies the value. If so, respect it, otherwise use the default as > before. > > -- > hundred-and-one symptoms of being an internet addict: > 98. The Alta Vista administrators ask you what sites are missing > in their index files. > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// Thank you Bram. I've got the point. How about this patch? I noticed the note in syntax.txt but still believe that the patch solves the strange behavior that most people will not configure what's going on until look into the source code. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 2138f02..9da27a8 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4991,8 +4991,6 @@ SpellRare Word that is recognized by the spellchecker as one that is StatusLine status line of current window *hl-StatusLineNC* StatusLineNC status lines of not-current windows - Note: if this is equal to "StatusLine" Vim will use "^^^" in - the status line of the current window. *hl-TabLine* TabLine tab pages line, not active tab page label *hl-TabLineFill* diff --git a/src/Makefile b/src/Makefile index d6a5ba4..a56c3fe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2102,6 +2102,7 @@ test_arglist \ test_feedkeys \ test_file_perm \ test_fileformat \ + test_fillchars \ test_filter_cmd \ test_filter_map \ test_fnameescape \ diff --git a/src/globals.h b/src/globals.h index 0b6abb0..81b0177 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1190,8 +1190,8 @@ EXTERN int lcs_conceal INIT(= ' '); #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \ || defined(FEAT_FOLDING) /* Characters from 'fillchars' option */ -EXTERN int fill_stl INIT(= ' '); -EXTERN int fill_stlnc INIT(= ' '); +EXTERN int fill_stl INIT(= NUL); +EXTERN int fill_stlnc INIT(= NUL); #endif #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) EXTERN int fill_vert INIT(= ' '); diff --git a/src/screen.c b/src/screen.c index ee61a01..c4ec1a9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -10532,13 +10532,11 @@ fillchar_status(int *attr, int is_curwin) *attr = hl_attr(HLF_SNC); fill = fill_stlnc; } - /* Use fill when there is highlighting, and highlighting of current - * window differs, or the fillchars differ, or this is not the - * current window */ - if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC) - || !is_curwin || ONE_WINDOW) - || (fill_stl != fill_stlnc))) + /* Use fill when there is highlighting */ + if (fill != NUL && *attr != 0) return fill; + if (ONE_WINDOW) + return ' '; if (is_curwin) return '^'; return '='; diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index d24b97f..abee0eb 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -14,6 +14,7 @@ source test_expand_dllpath.vim source test_feedkeys.vim source test_file_perm.vim source test_fileformat.vim +source test_fillchars.vim source test_filter_cmd.vim source test_filter_map.vim source test_fnamemodify.vim diff --git a/src/testdir/test_fillchars.vim b/src/testdir/test_fillchars.vim new file mode 100644 index 0000000..b8d5cde --- /dev/null +++ b/src/testdir/test_fillchars.vim @@ -0,0 +1,38 @@ +function! Test_fillchars_stl_stlnc_vert() diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 2138f02..9da27a8 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4991,8 +4991,6 @@ SpellRare Word that is recognized by the spellchecker as one that is StatusLine status line of current window *hl-StatusLineNC* StatusLineNC status lines of not-current windows - Note: if this is equal to "StatusLine" Vim will use "^^^" in - the status line of the current window. *hl-TabLine* TabLine tab pages line, not active tab page label *hl-TabLineFill* diff --git a/src/Makefile b/src/Makefile index d6a5ba4..a56c3fe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2102,6 +2102,7 @@ test_arglist \ test_feedkeys \ test_file_perm \ test_fileformat \ + test_fillchars \ test_filter_cmd \ test_filter_map \ test_fnameescape \ diff --git a/src/globals.h b/src/globals.h index 0b6abb0..81b0177 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1190,8 +1190,8 @@ EXTERN int lcs_conceal INIT(= ' '); #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \ || defined(FEAT_FOLDING) /* Characters from 'fillchars' option */ -EXTERN int fill_stl INIT(= ' '); -EXTERN int fill_stlnc INIT(= ' '); +EXTERN int fill_stl INIT(= NUL); +EXTERN int fill_stlnc INIT(= NUL); #endif #if defined(FEAT_WINDOWS) || defined(FEAT_FOLDING) EXTERN int fill_vert INIT(= ' '); diff --git a/src/screen.c b/src/screen.c index ee61a01..c4ec1a9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -10532,13 +10532,11 @@ fillchar_status(int *attr, int is_curwin) *attr = hl_attr(HLF_SNC); fill = fill_stlnc; } - /* Use fill when there is highlighting, and highlighting of current - * window differs, or the fillchars differ, or this is not the - * current window */ - if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC) - || !is_curwin || ONE_WINDOW) - || (fill_stl != fill_stlnc))) + /* Use fill when there is highlighting */ + if (fill != NUL && *attr != 0) return fill; + if (ONE_WINDOW) + return ' '; if (is_curwin) return '^'; return '='; diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index d24b97f..abee0eb 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -14,6 +14,7 @@ source test_expand_dllpath.vim source test_feedkeys.vim source test_file_perm.vim source test_fileformat.vim +source test_fillchars.vim source test_filter_cmd.vim source test_filter_map.vim source test_fnamemodify.vim diff --git a/src/testdir/test_fillchars.vim b/src/testdir/test_fillchars.vim new file mode 100644 index 0000000..b8d5cde --- /dev/null +++ b/src/testdir/test_fillchars.vim @@ -0,0 +1,38 @@ +function! Test_fillchars_stl_stlnc_vert() + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_,vert:* nosplitright + highlight StatusLine ctermbg=8 ctermfg=15 cterm=NONE guibg=#808080 guifg=#ffffff gui=NONE + highlight StatusLineNC ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + only! | vnew + redrawstatus! + call assert_equal('~', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) + echo assert_equal('*', nr2char(screenchar(1, winwidth(0) + 1))) +endfunction + +function! Test_fillchars_stl_stlnc_one_window() + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_ nosplitright + highlight StatusLine ctermbg=8 ctermfg=15 cterm=NONE guibg=#808080 guifg=#ffffff gui=NONE + only! + redrawstatus! + call assert_equal('~', nr2char(screenchar(winheight(0) + 1, 2))) +endfunction + +function! Test_fillchars_same_stl_stlnc_same_highlight() + set laststatus=2 statusline=\ fillchars=stl:_,stlnc:_ nosplitright + highlight StatusLine ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + highlight StatusLineNC ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + only! | vnew + redrawstatus! + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) +endfunction + +function! Test_fillchars_stl_stlnc_highlights_cleared() + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_ nosplitright + highlight clear StatusLine + highlight clear StatusLineNC + only! | vnew + redrawstatus! + call assert_equal('^', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('=', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) +endfunction + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_,vert:* nosplitright + highlight StatusLine ctermbg=8 ctermfg=15 cterm=NONE guibg=#808080 guifg=#ffffff gui=NONE + highlight StatusLineNC ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + only! | vnew + redrawstatus! + call assert_equal('~', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) + echo assert_equal('*', nr2char(screenchar(1, winwidth(0) + 1))) +endfunction + +function! Test_fillchars_stl_stlnc_one_window() + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_ nosplitright + highlight StatusLine ctermbg=8 ctermfg=15 cterm=NONE guibg=#808080 guifg=#ffffff gui=NONE + only! + redrawstatus! + call assert_equal('~', nr2char(screenchar(winheight(0) + 1, 2))) +endfunction + +function! Test_fillchars_same_stl_stlnc_same_highlight() + set laststatus=2 statusline=\ fillchars=stl:_,stlnc:_ nosplitright + highlight StatusLine ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + highlight StatusLineNC ctermbg=8 ctermfg=7 cterm=NONE guibg=#808080 guifg=#c0c0c0 gui=NONE + only! | vnew + redrawstatus! + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('_', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) +endfunction + +function! Test_fillchars_stl_stlnc_highlights_cleared() + set laststatus=2 statusline=\ fillchars=stl:~,stlnc:_ nosplitright + highlight clear StatusLine + highlight clear StatusLineNC + only! | vnew + redrawstatus! + call assert_equal('^', nr2char(screenchar(winheight(0) + 1, 2))) + call assert_equal('=', nr2char(screenchar(winheight(0) + 1, winwidth(0) + 3))) +endfunction Sincerely, Ken Hamada (aka itchyny on GitHub) -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. anualul de fata il continua pe cel pentru clasa a XI-a elaborat in 1991 si editat un an mai tarziu. Asadar dupa cunoasterea preistoriei protoistoriei antichitatii evului mediu si a tranzitiei spre modernizare a societatii din spatiul carpato-danubiano-pontic ne vom ocupa de modernitatea precum si de contemporaneitatea devenirii istorice pe aceste meleaguri. Trimitem astfel la introducerea manualului precedent care cuprinde intre altele definirea cronologica a structurilor epoci perioade etape corespunzatoare. Atragem atentia insa ca aceasta definire are un caracter orientativ reprezinta o varianta - inca discutabila- a periodizarii istoriei romanilor. De altfel acelasi lucru se intampla si in privinta studierii istoriei romanilor. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.** Documente privind istoria Romaniei. Rascoala din 1821 voi. I-V Bucuresti 1959-1982. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
