Merge #5326 'vim-patch:7.4.1547'

This commit is contained in:
Justin M. Keyes 2016-09-17 06:18:28 +02:00
commit 3a9da803cc
5 changed files with 35 additions and 6 deletions

View File

@ -7001,11 +7001,15 @@ highlight_color (
if (font || sp)
return NULL;
if (modec == 'c') {
if (fg)
if (fg) {
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
else
} else {
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
sprintf((char *)name, "%d", n);
}
if (n < 0) {
return NULL;
}
snprintf((char *)name, sizeof(name), "%d", n);
return name;
}
/* term doesn't have color */

View File

@ -8,4 +8,5 @@ source test_cmdline.vim
source test_menu.vim
source test_popup.vim
source test_regexp_utf8.vim
source test_syn_attr.vim
source test_unlet.vim

View File

@ -0,0 +1,24 @@
" Test syntax highlighting functions.
func Test_missing_attr()
hi Mine cterm=italic
call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
hi Mine cterm=inverse
call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
hi Mine cterm=standout gui=undercurl
call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
call assert_equal('1', synIDattr(hlID("Mine"), "undercurl", 'gui'))
hi Mine cterm=NONE gui=NONE
call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
if has('gui')
hi Mine guifg=blue guibg=red font=something
call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
call assert_equal('something', synIDattr(hlID("Mine"), "font", 'gui'))
endif
endfunc

View File

@ -730,7 +730,7 @@ static int included_patches[] = {
1550,
// 1549,
1548,
// 1547,
1547,
1546,
// 1545 NA
// 1544 NA

View File

@ -172,8 +172,8 @@ describe('synIDattr()', function()
it('returns cterm-color if RGB-capable UI is _not_ attached', function()
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
eq('252', eval('synIDattr(hlID("Normal"), "fg#")'))
eq('-1', eval('synIDattr(hlID("Normal"), "bg")'))
eq('-1', eval('synIDattr(hlID("Normal"), "bg#")'))
eq('', eval('synIDattr(hlID("Normal"), "bg")'))
eq('', eval('synIDattr(hlID("Normal"), "bg#")'))
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
eq('79', eval('synIDattr(hlID("Keyword"), "fg#")'))
eq('', eval('synIDattr(hlID("Keyword"), "sp")'))