vim-patch:8.0.1220: skipping empty statusline groups is not correct

Problem:    Skipping empty statusline groups is not correct.
Solution:   Also set group_end_userhl. (itchyny)
235dddf1f4
This commit is contained in:
Jan Edmund Lazo 2019-05-24 02:04:56 -04:00
parent 83c9d1df1b
commit 4ed654d9e8
2 changed files with 9 additions and 2 deletions

View File

@ -3485,9 +3485,10 @@ int build_stl_str_hl(
int group_start_userhl = 0;
int group_end_userhl = 0;
int n;
for (n = 0; n < groupitems[groupdepth]; n++) {
for (n = groupitems[groupdepth] - 1; n >= 0; n--) {
if (items[n].type == Highlight) {
group_start_userhl = items[n].minwid;
group_start_userhl = group_end_userhl = items[n].minwid;
break;
}
}
for (n = groupitems[groupdepth] + 1; n < curitem; n++) {

View File

@ -312,6 +312,12 @@ func Test_statusline()
call assert_equal(sa1, sa3)
call assert_equal(sa1, sa4)
let g:a = ''
set statusline=%#Error#{%(\ %{g:a}\ %)}
call assert_match('^{}\s*$', s:get_statusline())
let g:a = 'X'
call assert_match('^{ X }\s*$', s:get_statusline())
" %%: a percent sign.
set statusline=10%%
call assert_match('^10%\s*$', s:get_statusline())