mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
screen.c: Allow showbreak to override cursorline. (#13372)
I also added relevant tests. Close #13369
This commit is contained in:
@@ -2836,9 +2836,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
|
|||||||
* required when 'linebreak' is also set. */
|
* required when 'linebreak' is also set. */
|
||||||
if (tocol == vcol)
|
if (tocol == vcol)
|
||||||
tocol += n_extra;
|
tocol += n_extra;
|
||||||
/* combine 'showbreak' with 'cursorline' */
|
// Combine 'showbreak' with 'cursorline', prioritizing 'showbreak'.
|
||||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -604,7 +604,7 @@ describe("'listchars' highlight", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
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({
|
screen:set_default_attr_ids({
|
||||||
[1] = {background=Screen.colors.Grey90},
|
[1] = {background=Screen.colors.Grey90},
|
||||||
[2] = {
|
[2] = {
|
||||||
@@ -861,6 +861,57 @@ describe('CursorLine highlight', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
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()
|
it('always updated. vim-patch:8.1.0849', function()
|
||||||
local screen = Screen.new(50,5)
|
local screen = Screen.new(50,5)
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
|
Reference in New Issue
Block a user