Merge #7631 'highlight: no refresh on validation error'

This commit is contained in:
Justin M. Keyes 2017-11-25 23:22:46 +01:00
commit b57d9a4ff0
2 changed files with 44 additions and 1 deletions

View File

@ -6648,7 +6648,7 @@ do_highlight(char_u *line, int forceit, int init) {
if (error && idx == highlight_ga.ga_len) { if (error && idx == highlight_ga.ga_len) {
syn_unadd_group(); syn_unadd_group();
} else { } else {
if (is_normal_group) { if (!error && is_normal_group) {
// Need to update all groups, because they might be using "bg" and/or // Need to update all groups, because they might be using "bg" and/or
// "fg", which have been changed now. // "fg", which have been changed now.
highlight_attr_set_all(); highlight_attr_set_all();

View File

@ -0,0 +1,43 @@
local Screen = require('test.functional.ui.screen')
local helpers = require("test.functional.helpers")(after_each)
local eq, command = helpers.eq, helpers.command
local clear = helpers.clear
local eval, exc_exec = helpers.eval, helpers.exc_exec
describe(':highlight', function()
local screen
before_each(function()
clear()
screen = Screen.new()
screen:attach()
end)
after_each(function()
screen:detach()
end)
it('invalid color name', function()
eq('Vim(highlight):E421: Color name or number not recognized: ctermfg=#181818',
exc_exec("highlight normal ctermfg=#181818"))
eq('Vim(highlight):E421: Color name or number not recognized: ctermbg=#181818',
exc_exec("highlight normal ctermbg=#181818"))
end)
it('invalid group name', function()
eq('Vim(highlight):E411: highlight group not found: foo',
exc_exec("highlight foo"))
end)
it('"Normal" foreground with red', function()
eq('', eval('synIDattr(hlID("Normal"), "fg", "cterm")'))
command('highlight normal ctermfg=red')
eq('9', eval('synIDattr(hlID("Normal"), "fg", "cterm")'))
end)
it('"Normal" background with red', function()
eq('', eval('synIDattr(hlID("Normal"), "bg", "cterm")'))
command('highlight normal ctermbg=red')
eq('9', eval('synIDattr(hlID("Normal"), "bg", "cterm")'))
end)
end)