diff options
Diffstat (limited to 'src/nvim/plines.c')
-rw-r--r-- | src/nvim/plines.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c index b51d262cd9..acbb9637a4 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -222,21 +222,25 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp) if (mark.pos.row != cts->cts_row || mark.pos.col > col) { break; } else if (mark.pos.col == col) { - if (!mt_end(mark)) { - Decoration decor = get_decor(mark); - if (decor.virt_text_pos == kVTInline) { - if (mt_right(mark)) { - cts->cts_cur_text_width_right += decor.virt_text_width; - } else { - cts->cts_cur_text_width_left += decor.virt_text_width; - } - size += decor.virt_text_width; - if (*s == TAB) { - // tab size changes because of the inserted text - size -= tab_size; - tab_size = win_chartabsize(wp, s, vcol + size); - size += tab_size; + if (!mt_end(mark) && mark.flags & (MT_FLAG_DECOR_VIRT_TEXT_INLINE)) { + DecorInline decor = mt_decor(mark); + DecorVirtText *vt = decor.ext ? decor.data.ext.vt : NULL; + while (vt) { + if (!(vt->flags & kVTIsLines) && vt->pos == kVPosInline) { + if (mt_right(mark)) { + cts->cts_cur_text_width_right += vt->width; + } else { + cts->cts_cur_text_width_left += vt->width; + } + size += vt->width; + if (*s == TAB) { + // tab size changes because of the inserted text + size -= tab_size; + tab_size = win_chartabsize(wp, s, vcol + size); + size += tab_size; + } } + vt = vt->next; } } } |