diff options
-rw-r--r-- | src/nvim/screen.c | 4 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 53 |
2 files changed, 54 insertions, 3 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 425458f210..4373d6d5a8 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2836,9 +2836,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, * required when 'linebreak' is also set. */ if (tocol == vcol) tocol += n_extra; - /* combine 'showbreak' with 'cursorline' */ + // Combine 'showbreak' with 'cursorline', prioritizing 'showbreak'. if (wp->w_p_cul && lnum == wp->w_cursor.lnum) { - char_attr = hl_combine_attr(char_attr, win_hl_attr(wp, HLF_CUL)); + char_attr = hl_combine_attr(win_hl_attr(wp, HLF_CUL), char_attr); } } } diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 28e4e88326..ef3acd7d2e 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -604,7 +604,7 @@ describe("'listchars' highlight", function() ]]) end) - it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function() + it("'cursorline' and with 'listchars' option", function() screen:set_default_attr_ids({ [1] = {background=Screen.colors.Grey90}, [2] = { @@ -861,6 +861,57 @@ describe('CursorLine highlight', function() ]]) end) + it("overridden by NonText in 'showbreak' characters", function() + local screen = Screen.new(20,5) + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.Yellow, background = Screen.colors.Blue}; + [2] = {foreground = Screen.colors.Black, background = Screen.colors.White}; + [3] = {foreground = Screen.colors.Yellow, background = Screen.colors.White}; + [4] = {foreground = Screen.colors.Yellow}; + }) + screen:attach() + + feed_command('set wrap cursorline') + feed_command('set showbreak=>>>') + feed_command('highlight clear NonText') + feed_command('highlight clear CursorLine') + feed_command('highlight NonText guifg=Yellow guibg=Blue gui=NONE') + feed_command('highlight CursorLine guifg=Black guibg=White gui=NONE') + + feed('30iø<esc>o<esc>30ia<esc>') + screen:expect([[ + øøøøøøøøøøøøøøøøøøøø| + {1:>>>}øøøøøøøøøø | + {2:aaaaaaaaaaaaaaaaaaaa}| + {1:>>>}{2:aaaaaaaaa^a }| + | + ]]) + feed('k') + screen:expect([[ + {2:øøøøøøøøøøøøøøøøøøøø}| + {1:>>>}{2:øøøøøøøøø^ø }| + aaaaaaaaaaaaaaaaaaaa| + {1:>>>}aaaaaaaaaa | + | + ]]) + feed_command('highlight NonText guibg=NONE') + screen:expect([[ + {2:øøøøøøøøøøøøøøøøøøøø}| + {3:>>>}{2:øøøøøøøøø^ø }| + aaaaaaaaaaaaaaaaaaaa| + {4:>>>}aaaaaaaaaa | + | + ]]) + feed_command('set nocursorline') + screen:expect([[ + øøøøøøøøøøøøøøøøøøøø| + {4:>>>}øøøøøøøøø^ø | + aaaaaaaaaaaaaaaaaaaa| + {4:>>>}aaaaaaaaaa | + :set nocursorline | + ]]) + end) + it('always updated. vim-patch:8.1.0849', function() local screen = Screen.new(50,5) screen:set_default_attr_ids({ |