1
0
forked from aniani/vim

patch 9.0.0962: virtual text below cannot be placed below empty lines

Problem:    Virtual text below cannot be placed below empty lines.
Solution:   Add one character. (James Alvarado, closes #11606, closes #11520)
This commit is contained in:
porygonisaduck
2022-11-27 20:55:05 +00:00
committed by Bram Moolenaar
parent 3da8597fc0
commit 38854b565a
4 changed files with 53 additions and 5 deletions

View File

@@ -621,7 +621,7 @@ textprop_size_after_trunc(
text_prop_position(
win_T *wp,
textprop_T *tp,
int vcol UNUSED, // current text column
int vcol, // current text column
int scr_col, // current screen column
int *n_extra, // nr of bytes for virtual text
char_u **p_extra, // virtual text
@@ -633,7 +633,7 @@ text_prop_position(
int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW);
int wrap = (tp->tp_flags & TP_FLAG_WRAP);
int padding = tp->tp_col == MAXCOL && tp->tp_len > 1
? tp->tp_len - 1 : 0;
? tp->tp_len - 1 : 0;
int col_with_padding = scr_col + (below ? 0 : padding);
int room = wp->w_width - col_with_padding;
int before = room; // spaces before the text
@@ -661,11 +661,16 @@ text_prop_position(
// Right-align: fill with before
if (right)
before -= cells;
// Below-align: empty line add one character
if (below && vcol == 0 && col_with_padding == 0
&& wp->w_width == before)
col_with_padding = 1;
if (before < 0
|| !(right || below)
|| (below
? (col_with_padding <= col_off || !wp->w_p_wrap)
: (n_used < *n_extra)))
|| (below ? (col_with_padding <= col_off || !wp->w_p_wrap)
: (n_used < *n_extra)))
{
if (right && (wrap
|| (room < PROP_TEXT_MIN_CELLS && wp->w_p_wrap)))