aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/api.txt5
-rw-r--r--src/nvim/api/extmark.c5
-rw-r--r--src/nvim/drawline.c2
-rw-r--r--test/functional/ui/decorations_spec.lua37
4 files changed, 40 insertions, 9 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index f399f1ed25..ed8858820e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -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.
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 299413e510..aca290494b 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -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`
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 723c3e1c2b..cb512a6b55 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -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
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index b9080cbcf5..0247582cdd 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -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()