Merge #6537 from justinmk/hlcursor

Cursor highlight after `:highlight clear|syntax reset`
This commit is contained in:
Justin M. Keyes 2017-04-18 11:17:06 +02:00 committed by GitHub
commit 7debba9d42
2 changed files with 27 additions and 20 deletions

View File

@ -5898,6 +5898,8 @@ static void syntime_report(void)
static char *highlight_init_both[] = static char *highlight_init_both[] =
{ {
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
"Cursor guibg=fg guifg=bg",
"lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red", "DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
"ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White", "ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White",
"IncSearch cterm=reverse gui=reverse", "IncSearch cterm=reverse gui=reverse",

View File

@ -2,23 +2,23 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local os = require('os') local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command = helpers.command
local eval = helpers.eval
local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq
if helpers.pending_win32(pending) then return end
describe('colorscheme compatibility', function() describe('colorscheme compatibility', function()
before_each(function() before_each(function()
clear() clear()
end) end)
it('t_Co is set to 256 by default', function() it('t_Co is set to 256 by default', function()
eq('256', request('vim_eval', '&t_Co')) eq('256', eval('&t_Co'))
request('nvim_set_option', 't_Co', '88') request('nvim_set_option', 't_Co', '88')
eq('88', request('vim_eval', '&t_Co')) eq('88', eval('&t_Co'))
end) end)
end) end)
describe('manual syntax highlight', function() describe('highlight: `:syntax manual`', function()
-- When using manual syntax highlighting, it should be preserved even when -- When using manual syntax highlighting, it should be preserved even when
-- switching buffers... bug did only occur without :set hidden -- switching buffers... bug did only occur without :set hidden
-- Ref: vim patch 7.4.1236 -- Ref: vim patch 7.4.1236
@ -63,32 +63,32 @@ describe('manual syntax highlight', function()
end) end)
it("works with buffer switch and 'nohidden'", function() it("works with buffer switch and 'nohidden'", function()
feed_command('e tmp1.vim') command('e tmp1.vim')
feed_command('e Xtest-functional-ui-highlight.tmp.vim') command('e Xtest-functional-ui-highlight.tmp.vim')
feed_command('filetype on') command('filetype on')
feed_command('syntax manual') command('syntax manual')
feed_command('set ft=vim') command('set filetype=vim fileformat=unix')
feed_command('set syntax=ON') command('set syntax=ON')
feed('iecho 1<esc>0') feed('iecho 1<esc>0')
feed_command('set nohidden') command('set nohidden')
feed_command('w') command('w')
feed_command('bn') command('silent bn')
feed_command('bp') eq("tmp1.vim", eval("fnamemodify(bufname('%'), ':t')"))
feed_command('silent bp')
eq("Xtest-functional-ui-highlight.tmp.vim", eval("fnamemodify(bufname('%'), ':t')"))
screen:expect([[ screen:expect([[
{1:^echo} 1 | {1:^echo} 1 |
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
{0:~ }| {0:~ }|
<ht.tmp.vim" 1L, 7C | :silent bp |
]]) ]])
end) end)
end) end)
describe('Default highlight groups', function() describe('highlight defaults', function()
-- Test the default attributes for highlight groups shown by the :highlight
-- command
local screen local screen
before_each(function() before_each(function()
@ -281,6 +281,11 @@ describe('Default highlight groups', function()
]], {[0] = {bold=true, foreground=Screen.colors.Blue}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
end) end)
it('Cursor after `:hi clear|syntax reset` #6508', function()
command('highlight clear|syntax reset')
eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]]))
end)
it('Whitespace highlight', function() it('Whitespace highlight', function()
screen:try_resize(53, 4) screen:try_resize(53, 4)
feed_command('highlight NonText gui=NONE guifg=#FF0000') feed_command('highlight NonText gui=NONE guifg=#FF0000')