diff options
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r-- | src/nvim/drawline.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 863d237062..012cce7b22 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -1030,6 +1030,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, int left_curline_col = 0; int right_curline_col = 0; + VirtText virt_inline = KV_INITIAL_VALUE; + size_t virt_inline_i = 0; + int match_conc = 0; ///< cchar for match functions bool on_last_col = false; int syntax_flags = 0; @@ -1706,7 +1709,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, wlv.n_extra = 0; } - if (wlv.draw_state == WL_LINE && (area_highlighting || has_spell)) { + int extmark_attr = 0; + if (wlv.draw_state == WL_LINE + && (area_highlighting || has_spell || (extra_check && !has_fold))) { // handle Visual or match highlighting in this line if (wlv.vcol == wlv.fromcol || (wlv.vcol + 1 == wlv.fromcol && wlv.n_extra == 0 @@ -1787,6 +1792,44 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, wlv.char_attr = 0; } } + + if (has_decor && v >= 0) { + bool selected = (area_active || (area_highlighting && noinvcur + && wlv.vcol == wp->w_virtcol)); + extmark_attr = decor_redraw_col(wp, (colnr_T)v, wlv.off, + selected, &decor_state); + + // we could already be inside an existing virt_line with multiple chunks + if (!(virt_inline_i < kv_size(virt_inline))) { + DecorState *state = &decor_state; + for (size_t i = 0; i < kv_size(state->active); i++) { + DecorRange *item = &kv_A(state->active, i); + if (!(item->start_row == state->row + && kv_size(item->decor.virt_text) + && item->decor.virt_text_pos == kVTInline)) { + continue; + } + if (item->win_col >= -1 && item->start_col <= v) { + virt_inline = item->decor.virt_text; + virt_inline_i = 0; + item->win_col = -2; + break; + } + } + } + + if (wlv.n_extra <= 0 && virt_inline_i < kv_size(virt_inline)) { + VirtTextChunk vtc = kv_A(virt_inline, virt_inline_i); + wlv.p_extra = vtc.text; + wlv.n_extra = (int)strlen(wlv.p_extra); + wlv.c_extra = NUL; + wlv.c_final = NUL; + wlv.extra_attr = vtc.hl_id ? syn_id2attr(vtc.hl_id) : 0; + n_attr = wlv.n_extra; + extmark_attr = 0; + virt_inline_i++; + } + } } // Get the next character to put on the screen. @@ -2019,10 +2062,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, } if (has_decor && v > 0) { - bool selected = (area_active || (area_highlighting && noinvcur - && wlv.vcol == wp->w_virtcol)); - int extmark_attr = decor_redraw_col(wp, (colnr_T)v - 1, wlv.off, - selected, &decor_state); if (extmark_attr != 0) { if (!attr_pri) { wlv.char_attr = hl_combine_attr(wlv.char_attr, extmark_attr); |