From 7f9969c559b51446632ac7e8f76cde07e7d0078d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 25 Jul 2022 18:13:54 +0100 Subject: patch 9.0.0067: cannot show virtual text Problem: Cannot show virtual text. Solution: Initial changes for virtual text support, using text properties. --- src/getchar.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/getchar.c') diff --git a/src/getchar.c b/src/getchar.c index fc15daaf7d..a3de6509f5 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -3210,7 +3210,7 @@ vgetorpeek(int advance) && (c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, 3, 25L)) == 0) { - colnr_T col = 0, vcol; + colnr_T col = 0; char_u *ptr; if (mode_displayed) @@ -3242,24 +3242,30 @@ vgetorpeek(int advance) { if (did_ai) { + chartabsize_T cts; + /* * We are expecting to truncate the trailing * white-space, so find the last non-white * character -- webb */ - col = vcol = curwin->w_wcol = 0; + curwin->w_wcol = 0; ptr = ml_get_curline(); - while (col < curwin->w_cursor.col) + init_chartabsize_arg(&cts, curwin, + curwin->w_cursor.lnum, 0, ptr, ptr); + while (cts.cts_ptr < ptr + curwin->w_cursor.col) { - if (!VIM_ISWHITE(ptr[col])) - curwin->w_wcol = vcol; - vcol += lbr_chartabsize(ptr, ptr + col, - vcol); + if (!VIM_ISWHITE(*cts.cts_ptr)) + curwin->w_wcol = cts.cts_vcol; + cts.cts_vcol += lbr_chartabsize(&cts); if (has_mbyte) - col += (*mb_ptr2len)(ptr + col); + cts.cts_ptr += + (*mb_ptr2len)(cts.cts_ptr); else - ++col; + ++cts.cts_ptr; } + clear_chartabsize_arg(&cts); + curwin->w_wrow = curwin->w_cline_row + curwin->w_wcol / curwin->w_width; curwin->w_wcol %= curwin->w_width; -- cgit v1.2.3