diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-10-10 15:40:04 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-10 15:40:04 +0100 |
commit | 1206c163dbc8caace86e53f375f298af6cfab75a (patch) | |
tree | 19a25b91dd905d1e02cd997518e08291ccb574bb /src/drawline.c | |
parent | c601d988b6b1a672f71e3d61f4aaa4f7742a3a21 (diff) |
patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctlyv9.0.0714
Problem: With 'nowrap' two virtual text below not displayed correctly.
Solution: Set text_prop_follows before continuing. Correct for number
column. (closes #11333)
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/drawline.c b/src/drawline.c index e6a785e408..9aad81b9cc 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -578,7 +578,7 @@ textprop_size_after_trunc( int *n_used_ptr) { int space = (flags & (TP_FLAG_ALIGN_BELOW | TP_FLAG_ALIGN_ABOVE)) - ? wp->w_width : added; + ? wp->w_width - win_col_off(wp) : added; int len = (int)STRLEN(text); int strsize = 0; int n_used; @@ -634,6 +634,8 @@ text_prop_position( int strsize = vim_strsize(*p_extra); int cells = wrap ? strsize : textprop_size_after_trunc(wp, tp->tp_flags, before, padding, *p_extra, &n_used); + int cont_on_next_line = below && col_with_padding > win_col_off(wp) + && !wp->w_p_wrap; if (wrap || right || above || below || padding > 0 || n_used < *n_extra) { @@ -736,7 +738,11 @@ text_prop_position( *n_attr = mb_charlen(*p_extra); if (above) *n_attr -= padding + after; - *n_attr_skip = before + padding + skip_add; + + // Add "skip_add" when starting a new line or wrapping, + // n_attr_skip will then be decremented in the number column. + *n_attr_skip = before + padding + + (cont_on_next_line || before > 0 ? skip_add : 0); } } } @@ -1917,6 +1923,7 @@ win_line( -text_prop_id - 1]; int above = (tp->tp_flags & TP_FLAG_ALIGN_ABOVE); + int bail_out = FALSE; // reset the ID in the copy to avoid it being used // again @@ -2003,7 +2010,7 @@ win_line( break; } win_line_start(wp, &wlv, TRUE); - continue; + bail_out = TRUE; } } } @@ -2017,6 +2024,10 @@ win_line( && (wp->w_p_wrap || (text_props[other_tpi].tp_flags & (TP_FLAG_ALIGN_BELOW | TP_FLAG_ALIGN_RIGHT))); + + if (bail_out) + // starting a new line for "below" + continue; } } else if (text_prop_next < text_prop_count |