From 18b3500b8c517e44c23197e558aa36aed1c6916c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Oct 2022 20:35:37 +0100 Subject: patch 9.0.0661: multi-byte "lastline" in 'fillchars' does not work properly Problem: Multi-byte "lastline" item in 'fillchars' does not work properly when the window is two columns wide. Solution: Compute the text length correctly. (closes #11280) --- src/drawscreen.c | 8 ++++---- src/testdir/dumps/Test_display_lastline_6.dump | 10 ++++++++++ src/testdir/dumps/Test_display_lastline_euro_6.dump | 10 ++++++++++ src/testdir/test_display.vim | 4 ++++ src/version.c | 2 ++ 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 src/testdir/dumps/Test_display_lastline_6.dump create mode 100644 src/testdir/dumps/Test_display_lastline_euro_6.dump (limited to 'src') diff --git a/src/drawscreen.c b/src/drawscreen.c index 3ad7e00cc7..fe54ef5d81 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -2643,15 +2643,15 @@ win_update(win_T *wp) { int scr_row = W_WINROW(wp) + wp->w_height - 1; int symbol = wp->w_fill_chars.lastline; - int len; + int charlen; char_u fillbuf[12]; // 2 characters of 6 bytes - len = mb_char2bytes(symbol, &fillbuf[0]); - len += mb_char2bytes(symbol, &fillbuf[len]); + charlen = mb_char2bytes(symbol, &fillbuf[0]); + mb_char2bytes(symbol, &fillbuf[charlen]); // Last line isn't finished: Display "@@@" in the last screen line. screen_puts_len(fillbuf, - wp->w_width > 2 ? len : wp->w_width, + (wp->w_width > 2 ? 2 : wp->w_width) * charlen, 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), diff --git a/src/testdir/dumps/Test_display_lastline_6.dump b/src/testdir/dumps/Test_display_lastline_6.dump new file mode 100644 index 0000000000..e5ede7f67c --- /dev/null +++ b/src/testdir/dumps/Test_display_lastline_6.dump @@ -0,0 +1,10 @@ +>a+0&#ffffff0@1||+1&&|a+0&&@2| @68 +|a| ||+1&&|b+0&&@71 +@2||+1&&|b+0&&@71 +@2||+1&&|b+0&&@55| @15 +|b@1||+1&&|~+0#4040ff13&| @70 +|b+0#0000000&@1||+1&&|~+0#4040ff13&| @70 +|b+0#0000000&@1||+1&&|~+0#4040ff13&| @70 +|@@1||+1#0000000&|~+0#4040ff13&| @70 +|<+3#0000000&|1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @40|1|,|1| @11|A|l@1 +|:+0&&|2|v|s|p|l|i|t| @66 diff --git a/src/testdir/dumps/Test_display_lastline_euro_6.dump b/src/testdir/dumps/Test_display_lastline_euro_6.dump new file mode 100644 index 0000000000..80e2cbb0f4 --- /dev/null +++ b/src/testdir/dumps/Test_display_lastline_euro_6.dump @@ -0,0 +1,10 @@ +>a+0&#ffffff0@1||+1&&|a+0&&@2| @68 +|a| ||+1&&|b+0&&@71 +@2||+1&&|b+0&&@71 +@2||+1&&|b+0&&@55| @15 +|b@1||+1&&|~+0#4040ff13&| @70 +|b+0#0000000&@1||+1&&|~+0#4040ff13&| @70 +|b+0#0000000&@1||+1&&|~+0#4040ff13&| @70 +|€@1||+1#0000000&|~+0#4040ff13&| @70 +|<+3#0000000&|1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @40|1|,|1| @11|A|l@1 +|:+0&&|2|v|s|p|l|i|t| @66 diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim index 4d2ee9f202..faed0b58ef 100644 --- a/src/testdir/test_display.vim +++ b/src/testdir/test_display.vim @@ -419,6 +419,10 @@ func Run_Test_display_lastline(euro) call term_sendkeys(buf, ":3split\") call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}5', {}) + call term_sendkeys(buf, ":close\") + call term_sendkeys(buf, ":2vsplit\") + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}6', {}) + call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c index 3adb51332c..e9cc0ec3b4 100644 --- a/src/version.c +++ b/src/version.c @@ -699,6 +699,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 661, /**/ 660, /**/ -- cgit v1.2.3