summaryrefslogtreecommitdiffstats
path: root/src/drawline.c
diff options
context:
space:
mode:
authorporygonisaduck <alvaradx@umich.edu>2022-11-27 20:55:05 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-27 20:55:05 +0000
commit38854b565acba39eff36cf3c6396c911bf072bdc (patch)
tree229cef2a1c8e951af16695927d80c4bb9fbdffd8 /src/drawline.c
parent3da8597fc07505c0f8839b0834aafe1c10ffb456 (diff)
patch 9.0.0962: virtual text below cannot be placed below empty linesv9.0.0962
Problem: Virtual text below cannot be placed below empty lines. Solution: Add one character. (James Alvarado, closes #11606, closes #11520)
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 408f2d5bdb..8b19662c13 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -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)))