aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-28 17:29:44 +0800
committerGitHub <noreply@github.com>2023-05-28 17:29:44 +0800
commit9c41a81dec15ced3f66723b8aa87c2438a099128 (patch)
tree6fb822d0e050287640f857565440e2a93a977114
parent4dd43e31db8fa23b5189e074cff94f1491035aac (diff)
downloadrneovim-9c41a81dec15ced3f66723b8aa87c2438a099128.tar.gz
rneovim-9c41a81dec15ced3f66723b8aa87c2438a099128.tar.bz2
rneovim-9c41a81dec15ced3f66723b8aa87c2438a099128.zip
fix(extmarks): fix virt_text_hide off-by-one hiding (#23795)
-rw-r--r--src/nvim/drawline.c2
-rw-r--r--test/functional/ui/decorations_spec.lua15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index cb512a6b55..4968e667ed 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -1728,7 +1728,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
wlv.draw_state = WL_LINE;
if (has_decor && wlv.row == startrow + wlv.filler_lines) {
// hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
- decor_redraw_col(wp, (colnr_T)(ptr - line), wlv.off, true, &decor_state);
+ decor_redraw_col(wp, (colnr_T)(ptr - line) - 1, 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 4960a1d3ed..975da35355 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -837,9 +837,10 @@ describe('extmark decorations', function()
screen:try_resize(50, 3)
command('set nowrap')
meths.buf_set_lines(0, 0, -1, true, {'-- ' .. ('…'):rep(57)})
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text={{'?????', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true})
meths.buf_set_extmark(0, ns, 0, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true})
screen:expect{grid=[[
- ^-- …………………………………………………………………………………………………………{4:!!!!!}……|
+ {4:^?????}……………………………………………………………………………………………………{4:!!!!!}……|
{1:~ }|
|
]]}
@@ -849,7 +850,13 @@ describe('extmark decorations', function()
{1:~ }|
|
]]}
- feed('10zl')
+ feed('3zl')
+ screen:expect{grid=[[
+ {4:^!!!!!}……………………………… |
+ {1:~ }|
+ |
+ ]]}
+ feed('7zl')
screen:expect{grid=[[
^………………………… |
{1:~ }|
@@ -858,7 +865,7 @@ describe('extmark decorations', function()
command('set wrap smoothscroll')
screen:expect{grid=[[
- -- …………………………………………………………………………………………………………{4:!!!!!}……|
+ {4:?????}……………………………………………………………………………………………………{4:!!!!!}……|
^………………………… |
|
]]}
@@ -876,7 +883,7 @@ describe('extmark decorations', function()
]]}
feed('<C-Y>')
screen:expect{grid=[[
- -- …………………………………………………………………………………………………|
+ {4:?????}……………………………………………………………………………………………|
………{4:!!!!!}……………………………^… |
|
]]}