From ce53e3ea55d12d222a73510d772e786b7ae29c8d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 1 Sep 2023 18:49:30 +0200 Subject: patch 9.0.1836: display wrong with virttext, linebreak and breakindent Problem: Wrong display with "above" virtual text and 'linebreak' or 'breakindent' and 'showbreak'. Solution: Exclude size of "above" virtual text when calculating them. closes: #13000 Signed-off-by: Christian Brabandt Co-authored-by: zeertzjq --- src/charset.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/charset.c') diff --git a/src/charset.c b/src/charset.c index 3495a0ee17..dc8fa44833 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1209,17 +1209,18 @@ win_lbr_chartabsize( cells = text_prop_position(wp, tp, vcol, (vcol + size) % (wp->w_width - col_off) + col_off, &n_extra, &p, NULL, NULL, FALSE); -#ifdef FEAT_LINEBREAK +# ifdef FEAT_LINEBREAK no_sbr = TRUE; // don't use 'showbreak' now -#endif +# endif } else cells = vim_strsize(p); cts->cts_cur_text_width += cells; if (tp->tp_flags & TP_FLAG_ALIGN_ABOVE) cts->cts_first_char += cells; + else + size += cells; cts->cts_start_incl = tp->tp_flags & TP_FLAG_START_INCL; - size += cells; if (*s == TAB) { // tab size changes because of the inserted text @@ -1263,9 +1264,9 @@ win_lbr_chartabsize( int col_off_prev = win_col_off(wp); int width2 = wp->w_width - col_off_prev + win_col_off2(wp); colnr_T wcol = vcol + col_off_prev; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP wcol -= wp->w_virtcol_first_char; -#endif +# endif colnr_T max_head_vcol = cts->cts_max_head_vcol; int added = 0; @@ -1319,7 +1320,7 @@ win_lbr_chartabsize( else if (max_head_vcol > vcol + head_prev + prev_rem) head += (max_head_vcol - (vcol + head_prev + prev_rem) + width2 - 1) / width2 * head_mid; -#ifdef FEAT_PROP_POPUP +# ifdef FEAT_PROP_POPUP else if (max_head_vcol < 0) { int off = 0; @@ -1329,7 +1330,7 @@ win_lbr_chartabsize( if (off >= prev_rem) head += (1 + (off - prev_rem) / width) * head_mid; } -#endif +# endif } } @@ -1385,6 +1386,9 @@ win_lbr_chartabsize( } } +# ifdef FEAT_PROP_POPUP + size += cts->cts_first_char; +# endif return size; # endif #endif -- cgit v1.2.3