patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Problem: @@@ in the last line sometimes drawn in the wrong place.
Solution: Make sure the column is valid. (closes #10130)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 9f9cb09..135df1e 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -2617,8 +2617,8 @@
int scr_row = W_WINROW(wp) + wp->w_height - 1;
// Last line isn't finished: Display "@@@" in the last screen line.
- screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol,
- HL_ATTR(HLF_AT));
+ screen_puts_len((char_u *)"@@", wp->w_width > 2 ? 2 : wp->w_width,
+ scr_row, wp->w_wincol, HL_ATTR(HLF_AT));
screen_fill(scr_row, scr_row + 1,
(int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
'@', ' ', HL_ATTR(HLF_AT));
@@ -2627,10 +2627,13 @@
}
else if (dy_flags & DY_LASTLINE) // 'display' has "lastline"
{
+ int start_col = (int)W_ENDCOL(wp) - 3;
+
// Last line isn't finished: Display "@@@" at the end.
screen_fill(W_WINROW(wp) + wp->w_height - 1,
W_WINROW(wp) + wp->w_height,
- (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp),
+ start_col < wp->w_wincol ? wp->w_wincol : start_col,
+ (int)W_ENDCOL(wp),
'@', '@', HL_ATTR(HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;