diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index 96ee37e6aa..23a42798d9 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -26,6 +26,7 @@ #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" +#include "nvim/move.h" #include "nvim/pos_defs.h" #include "nvim/sign.h" @@ -1244,7 +1245,7 @@ Boolean nvim_win_add_ns(Window window, Integer ns_id, Error *err) set_put(uint32_t, &win->w_ns_set, (uint32_t)ns_id); - redraw_all_later(UPD_NOT_VALID); // TODO(altermo): only need to redraw the window + changed_window_setting_win(win); return true; } @@ -1289,7 +1290,7 @@ Boolean nvim_win_remove_ns(Window window, Integer ns_id, Error *err) set_del_uint32_t(&win->w_ns_set, (uint32_t)ns_id); - redraw_later(win, UPD_NOT_VALID); + changed_window_setting_win(win); return true; } diff --git a/src/nvim/plines.c b/src/nvim/plines.c index f3db2603d2..52d7ca9ca0 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -153,7 +153,8 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco if (mark.pos.row != csarg->virt_row || mark.pos.col > col) { break; } else if (mark.pos.col == col) { - if (!mt_end(mark) && mark.flags & (MT_FLAG_DECOR_VIRT_TEXT_INLINE)) { + if (!mt_end(mark) && (mark.flags & MT_FLAG_DECOR_VIRT_TEXT_INLINE) + && mt_scoped_in_win(mark, wp)) { DecorInline decor = mt_decor(mark); DecorVirtText *vt = decor.ext ? decor.data.ext.vt : NULL; while (vt) { diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index ac52b8a3c5..6e74d83a79 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -5577,6 +5577,29 @@ describe('decorations: window scoped', function() screen:expect(noextmarks) end) + it('redraws correctly with inline virt_text and wrapping', function() + set_scoped_extmark(0, 2, { + virt_text = {{ ('b'):rep(18), 'Comment' }}, + virt_text_pos = 'inline' + }) + + screen:expect(noextmarks) + + api.nvim_win_add_ns(0, ns) + + screen:expect { + grid = [[ + 12{1:bbbbbbbbbbbbbbbbbb}| + 34^5 | + {2:~ }|*7 + | + ]]} + + api.nvim_win_remove_ns(0, ns) + + screen:expect(noextmarks) + end) + pending('sign_text', function() -- TODO(altermo): The window signcolumn width is calculated wrongly (when `signcolumn=auto`) -- This happens in function `win_redraw_signcols` on line containing `buf_meta_total(buf, kMTMetaSignText) > 0`