diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 31ca9b16ce..7e92128b65 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -868,8 +868,8 @@ static void apply_cursorline_highlight(win_T *wp, winlinevars_T *wlv) } } -// Checks if there is more inline virtual text that need to be drawn -// and sets has_more_virt_inline_chunks to reflect that. +/// Checks if there is more inline virtual text that need to be drawn +/// and sets has_more_virt_inline_chunks to reflect that. static bool has_more_inline_virt(winlinevars_T *wlv, ptrdiff_t v) { DecorState *state = &decor_state; @@ -3096,8 +3096,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl || wlv.filler_todo > 0 || (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && wlv.p_extra != at_end_str) - || (wlv.n_extra != 0 - && (wlv.c_extra != NUL || *wlv.p_extra != NUL)) || wlv.more_virt_inline_chunks)) { + || (wlv.n_extra != 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL)) + || wlv.more_virt_inline_chunks)) { bool wrap = wp->w_p_wrap // Wrapping enabled. && wlv.filler_todo <= 0 // Not drawing diff filler lines. && lcs_eol_one != -1 // Haven't printed the lcs_eol character. diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index c6d5c20649..5ca554e753 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -2668,7 +2668,45 @@ bbbbbbb]]) ]]} end) - it('list "extends" is drawn with only inline virtual text offscreen', function() + it('lcs-extends is drawn with inline virtual text at end of screen line', function() + exec([[ + setlocal nowrap list listchars=extends:! + call setline(1, repeat('a', 51)) + ]]) + meths.buf_set_extmark(0, ns, 0, 50, { virt_text = { { 'bbb', 'Special' } }, virt_text_pos = 'inline' }) + feed('20l') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}| + {1:~ }| + | + ]]} + feed('zl') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:!}| + {1:~ }| + | + ]]} + feed('zl') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:b}{1:!}| + {1:~ }| + | + ]]} + feed('zl') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bb}{1:!}| + {1:~ }| + | + ]]} + feed('zl') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaa^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{10:bbb}a| + {1:~ }| + | + ]]} + end) + + it('lcs-extends is drawn with only inline virtual text offscreen', function() command('set nowrap') command('set list') command('set listchars+=extends:c') @@ -2826,9 +2864,9 @@ bbbbbbb]]) screen:try_resize(30, 6) exec([[ highlight! link LineNr Normal - call setline(1, repeat('a', 28)) setlocal number showbreak=+ breakindent breakindentopt=shift:2 setlocal scrolloff=0 smoothscroll + call setline(1, repeat('a', 28)) normal! $ ]]) meths.buf_set_extmark(0, ns, 0, 27, { virt_text = { { ('123'):rep(23) } }, virt_text_pos = 'inline' }) @@ -3066,8 +3104,8 @@ bbbbbbb]]) it('before TABs with smoothscroll', function() screen:try_resize(30, 6) exec([[ - call setline(1, repeat("\t", 4) .. 'a') setlocal list listchars=tab:<-> scrolloff=0 smoothscroll + call setline(1, repeat("\t", 4) .. 'a') normal! $ ]]) meths.buf_set_extmark(0, ns, 0, 3, { virt_text = { { ('12'):rep(32) } }, virt_text_pos = 'inline' }) diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 3ce7d1386b..301e2d0e40 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -938,7 +938,6 @@ func Test_cursor_position_with_showbreak() vim9script &signcolumn = 'yes' &showbreak = '++' - &breakindent = true &breakindentopt = 'shift:2' var leftcol: number = win_getid()->getwininfo()->get(0, {})->get('textoff') repeat('x', &columns - leftcol - 1)->setline(1) @@ -952,9 +951,14 @@ func Test_cursor_position_with_showbreak() " No line wraps, so changing 'showbreak' should lead to the same screen. call term_sendkeys(buf, "\\:setlocal showbreak=+\") call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_1', {}) + " No line wraps, so setting 'breakindent' should lead to the same screen. + call term_sendkeys(buf, "\\:setlocal breakindent\") + call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_1', {}) " The first line now wraps because of "eol" in 'listchars'. call term_sendkeys(buf, "\\:setlocal list\") call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_2', {}) + call term_sendkeys(buf, "\\:setlocal nobreakindent\") + call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak_3', {}) call StopVimInTerminal(buf) endfunc