From 18e5869f56aab8a52d84185e5bd043799c36ae2d Mon Sep 17 00:00:00 2001 From: Zach Wegner Date: Sun, 15 Sep 2019 14:16:44 -0500 Subject: Fix "precedes" listchar behavior in wrap mode Previously, the "precedes" character would be rendered on every row when w_skipcol > 0 (i.e., when viewing a single line longer than the entire screen), instead of just on the first row. Make sure to only render it on the first row in this case. Add a test for this behavior. Fix documentation for the "precedes" character, which erroneously stated that it was only active when wrap mode was off. --- test/functional/ui/highlight_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional/ui/highlight_spec.lua') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index f40f658275..95a19aec81 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -657,6 +657,30 @@ describe("'listchars' highlight", function() ]]) end) + it("'listchar' with wrap", function() + screen:set_default_attr_ids({ + [0] = {bold=true, foreground=Screen.colors.Blue}, + }) + feed_command('set wrap') + feed_command('set listchars=eol:¬,precedes:< list') + feed('90ia') + screen:expect([[ + {0:<}aaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaa| + aaaaaaaaa^a{0:¬} | + | + ]]) + feed('0') + screen:expect([[ + ^aaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaa| + | + ]]) + end) + it("'listchar' in visual mode", function() screen:set_default_attr_ids({ [1] = {background=Screen.colors.Grey90}, -- cgit From cb252071718a58c2d9747177ebeb81ff1210ddd1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 17 Jun 2019 22:35:07 +0200 Subject: vim-patch:8.0.0914: highlight attributes are always combined (#10256) Problem: Highlight attributes are always combined. Solution: Add the 'nocombine' value to replace attributes instead of combining them. (scauligi, closes vim/vim#1963) https://github.com/vim/vim/commit/0cd2a94a4030f6bd12eaec44db92db108e33c913 Closes https://github.com/neovim/neovim/pull/10256. --- test/functional/ui/highlight_spec.lua | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test/functional/ui/highlight_spec.lua') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 95a19aec81..1b25570997 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -438,6 +438,54 @@ describe('highlight', function() }) end) + it('nocombine', function() + screen:detach() + screen = Screen.new(25,6) + screen:set_default_attr_ids{ + [1] = {foreground = Screen.colors.SlateBlue, underline = true}, + [2] = {bold = true, foreground = Screen.colors.Blue1}, + [3] = {underline = true, reverse = true, foreground = Screen.colors.SlateBlue}, + [4] = {background = Screen.colors.Yellow, reverse = true, foreground = Screen.colors.SlateBlue}, + [5] = {foreground = Screen.colors.Red}, + } + screen:attach() + feed_command('syntax on') + feed_command('hi! Underlined cterm=underline gui=underline') + feed_command('syn keyword Underlined foobar') + feed_command('hi Search cterm=inverse,nocombine gui=inverse,nocombine') + insert([[ + foobar + foobar + ]]) + screen:expect{grid=[[ + {1:foobar} | + {1:foobar} | + ^ | + {2:~ }| + {2:~ }| + | + ]]} + + feed('/foo') + screen:expect{grid=[[ + {3:foo}{1:bar} | + {4:foo}{1:bar} | + | + {2:~ }| + {2:~ }| + /foo^ | + ]]} + feed('') + screen:expect{grid=[[ + {4:^foo}{1:bar} | + {4:foo}{1:bar} | + | + {2:~ }| + {2:~ }| + {5:search hit...uing at TOP} | + ]]} + end) + it('guisp (special/undercurl)', function() feed_command('syntax on') feed_command('syn keyword TmpKeyword neovim') -- cgit From 4987311fb5b8f4a11d26995f71f5f402a9e2ace4 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 13 Oct 2019 20:18:22 +0200 Subject: tests/ui: remove unnecessary screen:detach() It is perfectly fine and expected to detach from the screen just by the UI disconnecting from nvim or exiting nvim. Just keep detach() in screen_basic_spec, to get some coverage of the detach method itself. This avoids hang on failure in many situations (though one could argue that detach() should be "fast", or at least "as fast as resize", which works in press-return already). Never use detach() just to change the size of the screen, try_resize() method exists for that specifically. --- test/functional/ui/highlight_spec.lua | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'test/functional/ui/highlight_spec.lua') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 1b25570997..d7791a3107 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -35,7 +35,6 @@ describe('highlight: `:syntax manual`', function() end) after_each(function() - screen:detach() os.remove('Xtest-functional-ui-highlight.tmp.vim') end) @@ -97,10 +96,6 @@ describe('highlight defaults', function() command("set display-=msgsep") end) - after_each(function() - screen:detach() - end) - it('window status bar', function() screen:set_default_attr_ids({ [0] = {bold=true, foreground=Screen.colors.Blue}, @@ -346,17 +341,10 @@ describe('highlight defaults', function() end) describe('highlight', function() - local screen - - before_each(function() - clear() - screen = Screen.new(25,10) - screen:attach() - end) + before_each(clear) it('visual', function() - screen:detach() - screen = Screen.new(20,4) + local screen = Screen.new(20,4) screen:attach() screen:set_default_attr_ids({ [1] = {background = Screen.colors.LightGrey}, @@ -389,8 +377,7 @@ describe('highlight', function() end) it('cterm=standout gui=standout', function() - screen:detach() - screen = Screen.new(20,5) + local screen = Screen.new(20,5) screen:attach() screen:set_default_attr_ids({ [1] = {bold = true, foreground = Screen.colors.Blue1}, @@ -413,8 +400,7 @@ describe('highlight', function() end) it('strikethrough', function() - screen:detach() - screen = Screen.new(25,6) + local screen = Screen.new(25,6) screen:attach() feed_command('syntax on') feed_command('syn keyword TmpKeyword foo') @@ -439,8 +425,7 @@ describe('highlight', function() end) it('nocombine', function() - screen:detach() - screen = Screen.new(25,6) + local screen = Screen.new(25,6) screen:set_default_attr_ids{ [1] = {foreground = Screen.colors.SlateBlue, underline = true}, [2] = {bold = true, foreground = Screen.colors.Blue1}, @@ -487,6 +472,8 @@ describe('highlight', function() end) it('guisp (special/undercurl)', function() + local screen = Screen.new(25,10) + screen:attach() feed_command('syntax on') feed_command('syn keyword TmpKeyword neovim') feed_command('syn keyword TmpKeyword1 special') @@ -542,10 +529,6 @@ describe("'listchars' highlight", function() screen:attach() end) - after_each(function() - screen:detach() - end) - it("'cursorline' and 'cursorcolumn'", function() screen:set_default_attr_ids({ [0] = {bold=true, foreground=Screen.colors.Blue}, -- cgit From bfe84adb5a097488fa723f9917253bd6f0fbf662 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 28 Jan 2020 12:49:29 +0100 Subject: options: winhighlight: fix incorrect string equality test --- test/functional/ui/highlight_spec.lua | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/ui/highlight_spec.lua') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index d7791a3107..28e4e88326 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1186,6 +1186,7 @@ describe("'winhighlight' highlight", function() [25] = {bold = true, foreground = Screen.colors.Green1}, [26] = {background = Screen.colors.Red}, [27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1}, + [28] = {bold = true, foreground = Screen.colors.Brown}, }) command("hi Background1 guibg=DarkBlue") command("hi Background2 guibg=DarkGreen") @@ -1598,4 +1599,45 @@ describe("'winhighlight' highlight", function() {21:-- }{22:match 1 of 3} | ]]) end) + + it('can override CursorLine and CursorLineNr', function() + -- CursorLine used to be parsed as CursorLineNr, because strncmp + command('set cursorline number') + command('split') + command('set winhl=CursorLine:Background1') + screen:expect{grid=[[ + {28: 1 }{1:^ }| + {0:~ }| + {0:~ }| + {3:[No Name] }| + {28: 1 }{18: }| + {0:~ }| + {4:[No Name] }| + | + ]]} + + command('set winhl=CursorLineNr:Background2,CursorLine:Background1') + screen:expect{grid=[[ + {5: 1 }{1:^ }| + {0:~ }| + {0:~ }| + {3:[No Name] }| + {28: 1 }{18: }| + {0:~ }| + {4:[No Name] }| + | + ]]} + + feed('w') + screen:expect{grid=[[ + {5: 1 }{1: }| + {0:~ }| + {0:~ }| + {4:[No Name] }| + {28: 1 }{18:^ }| + {0:~ }| + {3:[No Name] }| + | + ]]} + end) end) -- cgit