summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-03 11:46:00 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-03 11:46:00 +0000
commit35d8c2010ea6ee5c9bcfa6a8285648172b92ed83 (patch)
treeca1dc088d5fcc6e11b15c5de07f329da7b9408b0
parentfe9112e630672dcd95e6b384c86f50c27ec10fed (diff)
patch 8.2.4497: wrong color for half of wide character next to pum scrollbarv8.2.4497
Problem: Wrong color for half of wide character next to pum scrollbar. Solution: Redraw the screen cell with the right color. (closes #9874)
-rw-r--r--src/screen.c5
-rw-r--r--src/testdir/dumps/Test_scrollbar_on_wide_char.dump10
-rw-r--r--src/testdir/test_ins_complete.vim18
-rw-r--r--src/version.c2
4 files changed, 34 insertions, 1 deletions
diff --git a/src/screen.c b/src/screen.c
index adcc4b5bab..db1a763aae 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1495,8 +1495,9 @@ screen_puts_len(
int textlen,
int row,
int col,
- int attr)
+ int attr_arg)
{
+ int attr = attr_arg;
unsigned off;
char_u *ptr = text;
int len = textlen;
@@ -1722,8 +1723,10 @@ screen_puts_len(
if (clear_next_cell)
{
// This only happens at the end, display one space next.
+ // Keep the attribute from before.
ptr = (char_u *)" ";
len = -1;
+ attr = ScreenAttrs[off];
}
}
else
diff --git a/src/testdir/dumps/Test_scrollbar_on_wide_char.dump b/src/testdir/dumps/Test_scrollbar_on_wide_char.dump
new file mode 100644
index 0000000000..04d7e7e1d0
--- /dev/null
+++ b/src/testdir/dumps/Test_scrollbar_on_wide_char.dump
@@ -0,0 +1,10 @@
+|a+0&#ffffff0@1|0|b@1> @69
+|a+0#0000001#e0e0e08@1|0|b@1| @9| +0#0000000#0000001|啊*0&#ffffff0| +&@56
+|a+0#0000001#ffd7ff255@1|1|b@1| @9| +0#0000000#0000001| +0&#ffffff0|哦*&| +&@55
+|a+0#0000001#ffd7ff255@1|2|b@1| @9| +0#0000000#0000001|呃*0&#ffffff0@1| +&@54
+|a+0#0000001#ffd7ff255@1|3|b@1| @9| +0#0000000#0000001| +0&#ffffff0@58
+|a+0#0000001#ffd7ff255@1|4|b@1| @9| +0#0000000#0000001| +0&#ffffff0@58
+|a+0#0000001#ffd7ff255@1|5|b@1| @9| +0#0000000#0000001| +0&#ffffff0@58
+|a+0#0000001#ffd7ff255@1|6|b@1| @9| +0#0000000#a8a8a8255| +0&#ffffff0@58
+|a+0#0000001#ffd7ff255@1|7|b@1| @9| +0#0000000#a8a8a8255| +0&#ffffff0@58
+|-+2&&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |1|0| +0#0000000&@32
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index cb643769ea..033bb37f12 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -606,6 +606,24 @@ func Test_pum_with_preview_win()
call delete('Xpreviewscript')
endfunc
+func Test_scrollbar_on_wide_char()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, ['a', ' 啊啊啊',
+ \ ' 哦哦哦',
+ \ ' 呃呃呃'])
+ call setline(5, range(10)->map({i, v -> 'aa' .. v .. 'bb'}))
+ END
+ call writefile(lines, 'Xwidescript')
+ let buf = RunVimInTerminal('-S Xwidescript', #{rows: 10})
+ call term_sendkeys(buf, "A\<C-N>")
+ call VerifyScreenDump(buf, 'Test_scrollbar_on_wide_char', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xwidescript')
+endfunc
+
" Test for inserting the tag search pattern in insert mode
func Test_ins_compl_tag_sft()
call writefile([
diff --git a/src/version.c b/src/version.c
index f3dff4f87d..73b6af7453 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4497,
+/**/
4496,
/**/
4495,