diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-28 21:20:16 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-28 21:21:46 +0200 |
commit | 1d3e0e8f3110a7807431eae056914ccea57b057b (patch) | |
tree | 9645ae44d0b927957ea7b0dcf9804bb497fb3e03 /src/charset.c | |
parent | 93ebb5e75e564403624314c84c97293427d001d6 (diff) |
patch 9.0.1813: linebreak incorrect drawn with breakindentv9.0.1813
Problem: 'linebreak' is incorrectly drawn after 'breakindent'.
Solution: Don't include 'breakindent' size when already after it.
closes: #12937
closes: #12940
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/charset.c b/src/charset.c index 1c7f7d7913..03ef3fd1c6 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1319,6 +1319,9 @@ win_lbr_chartabsize( vcol -= wp->w_virtcol_first_char; #endif colnr_T wcol = vcol + col_off_prev; + colnr_T max_head_vcol = cts->cts_max_head_vcol; + int added = 0; + // cells taken by 'showbreak'/'breakindent' before current char int head_prev = 0; if (wcol >= wp->w_width) @@ -1332,23 +1335,18 @@ win_lbr_chartabsize( if (wp->w_p_bri) head_prev += get_breakindent_win(wp, line); if (wcol < head_prev) - wcol = head_prev; - wcol += col_off_prev; - } - - if ((vcol > 0 && wcol == col_off_prev + head_prev) - || wcol + size > wp->w_width) - { - int added = 0; - colnr_T max_head_vcol = cts->cts_max_head_vcol; - - if (vcol > 0 && wcol == col_off_prev + head_prev) { + head_prev -= wcol; + wcol += head_prev; added += head_prev; if (max_head_vcol <= 0 || vcol < max_head_vcol) head += head_prev; } + wcol += col_off_prev; + } + if (wcol + size > wp->w_width) + { // cells taken by 'showbreak'/'breakindent' halfway current char int head_mid = 0; if (*sbr != NUL) @@ -1384,9 +1382,9 @@ win_lbr_chartabsize( } #endif } - - size += added; } + + size += added; } if (headp != NULL) *headp = head; |