Skip to content

Commit

Permalink
patch 8.2.0235: draw error when an empty group is removed from 'statu…
Browse files Browse the repository at this point in the history
…sline'

Problem:    Draw error when an empty group is removed from 'statusline'.
Solution:   Do not use highlighting from a removed group.
  • Loading branch information
brammool committed Feb 8, 2020
1 parent d5b9914 commit dbe5d36
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4216,6 +4216,10 @@ build_stl_str_hl(
{
p = t;
l = 0;
// do not use the highlighting from the removed group
for (n = groupitem[groupdepth] + 1; n < curitem; n++)
if (item[n].type == Highlight)
item[n].type = Empty;
}
}
if (l > item[groupitem[groupdepth]].maxwid)
Expand Down
10 changes: 10 additions & 0 deletions src/testdir/dumps/Test_statusline_1.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
> +0&#ffffff0@49
|~+0#4040ff13&| @48
|~| @48
|~| @48
|~| @48
|~| @48
|~| @48
|~| @48
| +3#0000000&|Q|≡| @46
| +0&&@49
20 changes: 20 additions & 0 deletions src/testdir/test_statusline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

source view_util.vim
source check.vim
source screendump.vim

func s:get_statusline()
return ScreenLines(&lines - 1, &columns)[0]
Expand Down Expand Up @@ -393,3 +394,22 @@ func Test_statusline_visual()
bwipe! x1
bwipe! x2
endfunc

func Test_statusline_removed_group()
CheckScreendump

let lines =<< trim END
scriptencoding utf-8
set laststatus=2
let &statusline = '%#StatColorHi2#%(✓%#StatColorHi2#%) Q≡'
END
call writefile(lines, 'XTest_statusline')

let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
call term_wait(buf, 100)
call VerifyScreenDump(buf, 'Test_statusline_1', {})

" clean up
call StopVimInTerminal(buf)
call delete('XTest_statusline')
endfunc
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
235,
/**/
234,
/**/
Expand Down

0 comments on commit dbe5d36

Please sign in to comment.