syntax: fix missing newlines in execute("syn list"). fixes #10467

This commit is contained in:
Björn Linse 2019-07-13 20:08:28 +02:00
parent 4013f67053
commit c2b3cc970c
2 changed files with 42 additions and 1 deletions

View File

@ -7224,7 +7224,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
}
msg_outtrans(HL_TABLE()[id - 1].sg_name);
endcol = 15;
} else if (ui_has(kUIMessages) || msg_silent) {
} else if ((ui_has(kUIMessages) || msg_silent) && outlen < 999) {
msg_putchar(' ');
adjust = false;
} else if (msg_col + outlen + 1 >= Columns) {

View File

@ -804,6 +804,7 @@ describe('ui/builtin messages', function()
[3] = {bold = true, reverse = true},
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
[5] = {foreground = Screen.colors.Blue1},
[6] = {bold = true, foreground = Screen.colors.Magenta},
})
end)
@ -856,6 +857,46 @@ describe('ui/builtin messages', function()
eq('ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red',
meths.command_output("hi ErrorMsg"))
end)
it(':syntax list langGroup output', function()
command("syntax on")
command("set syntax=vim")
screen:try_resize(110,7)
feed(':syntax list vimComment<cr>')
screen:expect([[
{6:--- Syntax items ---} |
vimComment {5:xxx} {5:match} /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 {5:excludenl} {5:contains}=@vimCommentGroup,vimCommentString |
|
{5:match} /\<endif\s\+".*$/ms=s+5,lc=5 {5:contains}=@vimCommentGroup,vimCommentString |
{5:match} /\<else\s\+".*$/ms=s+4,lc=4 {5:contains}=@vimCommentGroup,vimCommentString |
{5:links to} Comment |
{4:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
screen:try_resize(55,7)
feed(':syntax list vimComment<cr>')
screen:expect([[
|
{5:match} /\<endif\s\+".*$/ms=s+5,lc=5 |
{5:contains}=@vimCommentGroup,vimCommentString |
{5:match} /\<else\s\+".*$/ms=s+4,lc=4 {5:c}|
{5:ontains}=@vimCommentGroup,vimCommentString |
{5:links to} Comment |
{4:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
-- ignore final whitespace inside string
-- luacheck: push ignore
eq([[--- Syntax items ---
vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vimCommentGroup,vimCommentString
match /\<endif\s\+".*$/ms=s+5,lc=5 contains=@vimCommentGroup,vimCommentString
match /\<else\s\+".*$/ms=s+4,lc=4 contains=@vimCommentGroup,vimCommentString
links to Comment]],
meths.command_output('syntax list vimComment'))
-- luacheck: pop
end)
end)
describe('ui/ext_messages', function()