diff options
Diffstat (limited to 'test/functional/ui/highlight_spec.lua')
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 136 |
1 files changed, 132 insertions, 4 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 288c2a214f..7776e024b0 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -8,6 +8,7 @@ local feed_command, eq = helpers.feed_command, helpers.eq local curbufmeths = helpers.curbufmeths local funcs = helpers.funcs local meths = helpers.meths +local exec_lua = helpers.exec_lua describe('colorscheme compatibility', function() before_each(function() @@ -376,7 +377,6 @@ describe('highlight', function() -- Vertical cursor: highlights char-at-cursor. #8983 command('set guicursor=a:block-blinkon175') - feed('<esc>gg$vhhh') screen:expect([[ line1 foo{1:^ bar} | | @@ -427,7 +427,7 @@ describe('highlight', function() ^ | {2:~ }| | - ]],{ + ]], { [1] = {strikethrough = true}, [2] = {bold = true, foreground = Screen.colors.Blue1}, }) @@ -516,7 +516,7 @@ describe('highlight', function() {1:neovim} tabbed^ | {0:~ }| {5:-- INSERT --} | - ]],{ + ]], { [0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, special = Screen.colors.Red}, @@ -527,6 +527,41 @@ describe('highlight', function() }) end) + + it("'diff', syntax and extmark #23722", function() + local screen = Screen.new(25,10) + screen:attach() + exec([[ + new + call setline(1, ['', '01234 6789']) + windo diffthis + wincmd w + syn match WarningMsg "^.*$" + call nvim_buf_add_highlight(0, -1, 'ErrorMsg', 1, 2, 8) + ]]) + screen:expect([[ + {1: }^ | + {1: }{2:01}{3:234 67}{2:89}{5: }| + {4:~ }| + {4:~ }| + {7:[No Name] [+] }| + {1: } | + {1: }{6:-----------------------}| + {4:~ }| + {8:[No Name] }| + | + ]], { + [0] = {Screen.colors.WebGray, foreground = Screen.colors.DarkBlue}, + [1] = {background = Screen.colors.Grey, foreground = Screen.colors.Blue4}, + [2] = {foreground = Screen.colors.Red, background = Screen.colors.LightBlue}, + [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.LightBlue}, + [4] = {bold = true, foreground = Screen.colors.Blue}, + [5] = {background = Screen.colors.LightBlue}, + [6] = {bold = true, background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1}, + [7] = {reverse = true, bold = true}, + [8] = {reverse = true}, + }) + end) end) describe("'listchars' highlight", function() @@ -1412,10 +1447,10 @@ describe('ColorColumn highlight', function() [3] = {foreground = Screen.colors.Brown}, -- LineNr [4] = {foreground = Screen.colors.Brown, bold = true}, -- CursorLineNr [5] = {foreground = Screen.colors.Blue, bold = true}, -- NonText - -- NonText and ColorColumn [6] = {foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true}, [7] = {reverse = true, bold = true}, -- StatusLine [8] = {reverse = true}, -- StatusLineNC + [9] = {background = Screen.colors.Grey90, foreground = Screen.colors.Red}, }) screen:attach() end) @@ -1501,6 +1536,25 @@ describe('ColorColumn highlight', function() | ]]) end) + + it('is combined with low-priority CursorLine highlight #23016', function() + screen:try_resize(40, 2) + command('set colorcolumn=30 cursorline') + screen:expect([[ + {2:^ }{1: }{2: }| + | + ]]) + command('hi clear ColorColumn') + screen:expect([[ + {2:^ }| + | + ]]) + command('hi ColorColumn guifg=Red') + screen:expect([[ + {2:^ }{9: }{2: }| + | + ]]) + end) end) describe("MsgSeparator highlight and msgsep fillchar", function() @@ -1812,6 +1866,31 @@ describe("'winhighlight' highlight", function() ]]) end) + it('works for background color in rightleft window #22640', function() + -- Use a wide screen to also check that this doesn't overflow linebuf_attr. + screen:try_resize(80, 6) + insert('aa') + command('setlocal rightleft') + command('setlocal winhl=Normal:Background1') + screen:expect([[ + {1: ^aa}| + {2: ~}| + {2: ~}| + {2: ~}| + {2: ~}| + | + ]]) + command('botright vsplit') + screen:expect([[ + {1: aa│ ^aa}| + {2: ~}{1:│}{2: ~}| + {2: ~}{1:│}{2: ~}| + {2: ~}{1:│}{2: ~}| + {4:[No Name] [+] }{3:[No Name] [+] }| + | + ]]) + end) + it('handles undefined groups', function() command("set winhl=Normal:Background1") screen:expect([[ @@ -2408,6 +2487,23 @@ describe("'winhighlight' highlight", function() | ]]} end) + + it('can link to empty highlight group', function() + command 'hi NormalNC guibg=Red' -- czerwone time + command 'set winhl=NormalNC:Normal' + command 'split' + + screen:expect{grid=[[ + ^ | + {0:~ }| + {0:~ }| + {3:[No Name] }| + | + {0:~ }| + {4:[No Name] }| + | + ]]} + end) end) describe('highlight namespaces', function() @@ -2427,6 +2523,8 @@ describe('highlight namespaces', function() [6] = {bold = true, reverse = true}; [7] = {reverse = true}; [8] = {foreground = Screen.colors.Gray20}; + [9] = {foreground = Screen.colors.Blue}; + [10] = {bold = true, foreground = Screen.colors.SeaGreen}; } ns1 = meths.create_namespace 'grungy' @@ -2546,4 +2644,34 @@ describe('highlight namespaces', function() | ]]} end) + + it('winhl does not accept invalid value #24586', function() + local res = exec_lua([[ + local curwin = vim.api.nvim_get_current_win() + vim.api.nvim_command("set winhl=Normal:Visual") + local _, msg = pcall(vim.api.nvim_command,"set winhl='Normal:Wrong'") + return { msg, vim.wo[curwin].winhl } + ]]) + eq({ + "Vim(set):E5248: Invalid character in group name", + "Normal:Visual", + },res) + end) + + it('Normal in set_hl #25474', function() + meths.set_hl(0, 'Normal', {bg='#333333'}) + command('highlight Ignore') + screen:expect{grid=[[ + | + {1:~ }| + {1:~ }| + {6: }| + | + Ignore {8:xxx} {9:ctermf}| + {9:g=}15 {9:guifg=}| + bg | + {10:Press ENTER or type comma}| + {10:nd to continue}^ | + ]]} + end) end) |