]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2095: statusline may look different than expected v9.0.2095
authorChristian Brabandt <cb@256bit.org>
Wed, 8 Nov 2023 20:23:29 +0000 (21:23 +0100)
committerChristian Brabandt <cb@256bit.org>
Wed, 8 Nov 2023 20:23:29 +0000 (21:23 +0100)
Problem:  statusline may look different than expected
Solution: do not check for highlighting of stl and stlnc characters

statusline fillchar may be different than expected

If the highlighting group for the statusline for the current window
|hl-StatusLine| or the non-current window |hl-StatusLineNC| are cleared
(or do not differ from each other), than Vim will use the hard-coded
fallback values '^' (for the non-current windows) or '=' (for the
current window).  I believe this was done, to make sure the statusline
will always be visible and be distinguishable from the rest of the
window.

However, this may be unexpected, if a user explicitly defined those
fillchar characters just to notice that those values are then not used
by Vim.

So, let's assume users know what they are doing and just always return
the configured stl and stlnc values.  And if they want the statusline to
be non-distinguishable from the rest of the window space, so be it.  It
is their responsibility and Vim shall not know better what to use.

fixes: #13366
closes: #13488

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/options.txt
src/screen.c
src/testdir/dumps/Test_statusline_stl_1.dump [new file with mode: 0644]
src/testdir/test_statusline.vim
src/version.c

index 8f57ac0f0d30a1b386f0b88c4bb7a12e2481d3d5..be59b69a30cc17e5bd65ea66d32b734f1ca87e38 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.0.  Last change: 2023 Oct 23
+*options.txt*  For Vim version 9.0.  Last change: 2023 Nov 06
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -3494,8 +3494,8 @@ A jump table for the options with a short description can be found at |Q_op|.
        and the value of that item:
 
          item name     default         Used for ~
-         stl           ' ' or '^'      statusline of the current window
-         stlnc         ' ' or '='      statusline of the non-current windows
+         stl           ' '             statusline of the current window
+         stlnc         ' '             statusline of the non-current windows
          vert          '|'             vertical separators |:vsplit|
          fold          '-'             filling 'foldtext'
          foldopen      '-'             mark the beginning of a fold
@@ -3505,15 +3505,11 @@ A jump table for the options with a short description can be found at |Q_op|.
          eob           '~'             empty lines below the end of a buffer
          lastline      '@'             'display' contains lastline/truncate
 
-       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 '='
-       otherwise.
+       Any one that is omitted will fall back to the default.
 
        Example: >
-           :set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:-
-<      This is similar to the default, except that these characters will also
-       be used when there is highlighting.
-
+           :set fillchars=stl:\ ,stlnc:\ ,vert:\|,fold:-,diff:-
+<
        For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items
        single-byte and multibyte characters are supported.  But double-width
        characters are not supported.
index 3d931ab4e53989a8858c6187b2a2528e61ee0270..fd69cf0b3dd354e0121089eb1f3d638dcab6645e 100644 (file)
@@ -4462,16 +4462,7 @@ fillchar_status(int *attr, win_T *wp)
        *attr = HL_ATTR(HLF_SNC);
        fill = wp->w_fill_chars.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)
-                       || wp != curwin || ONE_WINDOW)
-                   || (wp->w_fill_chars.stl != wp->w_fill_chars.stlnc)))
-       return fill;
-    if (wp == curwin)
-       return '^';
-    return '=';
+    return fill;
 }
 
 /*
diff --git a/src/testdir/dumps/Test_statusline_stl_1.dump b/src/testdir/dumps/Test_statusline_stl_1.dump
new file mode 100644 (file)
index 0000000..ab1133c
--- /dev/null
@@ -0,0 +1,20 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+0#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| @74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+0#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| @74
index 1239e4e4ee3f7169fc76ea835693a1db5e59a5ab..22fd78cdefcc39263181cbd0708e25e19be8c984 100644 (file)
@@ -610,4 +610,25 @@ func Test_statusline_showcmd()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_statusline_highlight_group_cleared()
+  CheckScreendump
+
+  " the laststatus option is there to prevent
+  " the code-style test from complaining about
+  " trailing whitespace
+  let lines =<< trim END
+    set fillchars=stl:\ ,stlnc:\  laststatus=2
+    split
+    hi clear StatusLine
+    hi clear StatusLineNC
+  END
+  call writefile(lines, 'XTest_statusline_stl', 'D')
+
+  let buf = RunVimInTerminal('-S XTest_statusline_stl', {})
+
+  call VerifyScreenDump(buf, 'Test_statusline_stl_1', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index d4fe38f28612204d5d7decca52628a80c615d266..1e45be1bee94bdf79e2bed050924327c999e2b54 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2095,
 /**/
     2094,
 /**/