mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
test(extmarks): add test for virt_text_hide with 'smoothscroll' (#23791)
This commit is contained in:
parent
7a8402ac31
commit
e41b2e34b4
@ -2614,8 +2614,9 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
|
||||
• virt_text_win_col : position the virtual text at a fixed
|
||||
window column (starting from the first text column)
|
||||
• virt_text_hide : hide the virtual text when the background
|
||||
text is selected or hidden due to horizontal scroll
|
||||
'nowrap'
|
||||
text is selected or hidden because of scrolling with
|
||||
'nowrap' or 'smoothscroll'. Currently only affects
|
||||
"overlay" virt_text.
|
||||
• hl_mode : control how highlights are combined with the
|
||||
highlights of the text. Currently only affects virt_text
|
||||
highlights, but might affect `hl_group` in later versions.
|
||||
|
@ -483,8 +483,9 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
|
||||
/// window column (starting from the first
|
||||
/// text column)
|
||||
/// - virt_text_hide : hide the virtual text when the background
|
||||
/// text is selected or hidden due to
|
||||
/// horizontal scroll 'nowrap'
|
||||
/// text is selected or hidden because of
|
||||
/// scrolling with 'nowrap' or 'smoothscroll'.
|
||||
/// Currently only affects "overlay" virt_text.
|
||||
/// - hl_mode : control how highlights are combined with the
|
||||
/// highlights of the text. Currently only affects
|
||||
/// virt_text highlights, but might affect `hl_group`
|
||||
|
@ -1727,7 +1727,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
sign_idx = 0;
|
||||
wlv.draw_state = WL_LINE;
|
||||
if (has_decor && wlv.row == startrow + wlv.filler_lines) {
|
||||
// hide virt_text on text hidden by 'nowrap'
|
||||
// hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
|
||||
decor_redraw_col(wp, (colnr_T)(ptr - line), wlv.off, true, &decor_state);
|
||||
}
|
||||
win_line_continue(&wlv); // use wlv.saved_ values
|
||||
|
@ -827,26 +827,55 @@ describe('extmark decorations', function()
|
||||
end -- ?古古古古?古古 |
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
screen:try_resize(50, 2)
|
||||
it('virt_text_hide hides overlay virtual text when extmark is off-screen', function()
|
||||
screen:try_resize(50, 3)
|
||||
command('set nowrap')
|
||||
meths.buf_set_lines(0, 12, 12, true, {'-- ' .. ('…'):rep(57)})
|
||||
feed('G')
|
||||
meths.buf_set_extmark(0, ns, 12, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true})
|
||||
meths.buf_set_lines(0, 0, -1, true, {'-- ' .. ('…'):rep(57)})
|
||||
meths.buf_set_extmark(0, ns, 0, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true})
|
||||
screen:expect{grid=[[
|
||||
^-- …………………………………………………………………………………………………………{4:!!!!!}……|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('40zl')
|
||||
screen:expect{grid=[[
|
||||
^………{4:!!!!!}……………………………… |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('10zl')
|
||||
screen:expect{grid=[[
|
||||
^………………………… |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
|
||||
command('set wrap smoothscroll')
|
||||
screen:expect{grid=[[
|
||||
-- …………………………………………………………………………………………………………{4:!!!!!}……|
|
||||
^………………………… |
|
||||
|
|
||||
]]}
|
||||
feed('<C-E>')
|
||||
screen:expect{grid=[[
|
||||
{1:<<<}………………^… |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
screen:try_resize(40, 3)
|
||||
screen:expect{grid=[[
|
||||
{1:<<<}{4:!!!!!}……………………………^… |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('<C-Y>')
|
||||
screen:expect{grid=[[
|
||||
-- …………………………………………………………………………………………………|
|
||||
………{4:!!!!!}……………………………^… |
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('can have virtual text of overlay position and styling', function()
|
||||
|
Loading…
Reference in New Issue
Block a user