diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-24 02:04:56 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-24 02:07:37 -0400 |
commit | 4ed654d9e8873a4ed3666396a215cfd6287b4ef7 (patch) | |
tree | d54aa0a95ce6b067bffe436e8bfbf4eff699ae87 /src | |
parent | 83c9d1df1b11326327c69cb009235a2e02fb31ed (diff) | |
download | rneovim-4ed654d9e8873a4ed3666396a215cfd6287b4ef7.tar.gz rneovim-4ed654d9e8873a4ed3666396a215cfd6287b4ef7.tar.bz2 rneovim-4ed654d9e8873a4ed3666396a215cfd6287b4ef7.zip |
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)
https://github.com/vim/vim/commit/235dddf1f4afe3a40047dbf2aca1bd177b7be18b
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 88e19fd135..8a3d4ad418 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -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++) { diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index de943f2466..eafbecdf69 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -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()) |