commit 332b70d2ed310084fe382affddbef3126c12751c
parent ecf225df574a48a4bbddf4978972b2b97184e92c
Author: Ibby <33922797+SleepySwords@users.noreply.github.com>
Date: Mon, 3 Apr 2023 23:12:56 +1000
fix(ui): fix incorrect highlighting when virtual text wraps with number
Diffstat:
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
@@ -1942,7 +1942,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
// Only restore search_attr and area_attr after "n_extra" in
// the next screen line is also done.
- if (wlv.n_extra <= 0) {
+ if (wlv.n_extra <= 0 && wlv.saved_n_extra <= 0) {
if (search_attr == 0) {
search_attr = saved_search_attr;
}
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
@@ -1843,6 +1843,33 @@ bbbbbbb]])
|
]]}
end)
+
+ it('highlighting is correct when virtual text wraps with number', function()
+ insert([[
+ test
+ test]])
+ command('set number')
+ meths.buf_set_extmark(0, ns, 0, 1,
+ { virt_text = { { string.rep('X', 55), 'Special' } }, virt_text_pos = 'inline', right_gravity = false })
+ feed('gg0')
+ screen:expect { grid = [[
+ {2: 1 }^t{28:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}|
+ {2: }{28:XXXXXXXXXX}est |
+ {2: 2 }test |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ end)
end)
describe('decorations: virtual lines', function()