else if (wlv.line_attr)
wlv.char_attr = hl_combine_attr(
wlv.char_attr, wlv.line_attr);
+ // Show a Visual or search highlight on the first cell
+ // of an empty line, on top of the background color.
+ if (wlv.vcol == 0)
+ {
+ if (area_attr != 0)
+ wlv.char_attr = hl_combine_attr(
+ wlv.char_attr, area_attr);
+ else if (search_attr != 0)
+ wlv.char_attr = hl_combine_attr(
+ wlv.char_attr, search_attr);
+ }
}
# endif
}
--- /dev/null
+| +0#0000001#a8a8a8255| +0#0000000#8080809@73
+|o+0#0000001#a8a8a8255|l|d| +0#0000000#8080809@71
+| +0#0000001#a8a8a8255| +0#0000000#8080809@73
+> +0&#ffffff0@74
+|!+2#ffffff16#00e0003|s|h| |.|/|X|t|e|r|m|_|c|o|l|o|r|e|d|.|s|h| |[|f|i|n|i|s|h|e|d|]| @23|4|,|0|-|1| @9|A|l@1
+| +0#0000000#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|[+1#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+|-+2&&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@46|4| @9
call StopVimInTerminal(buf)
endfunc
+func Test_terminal_visual_colored_empty_line()
+ CheckScreendump
+ CheckRunVimInTerminal
+ CheckUnix
+
+ " Empty lines erased with a gray background (CSI 100m, CSI K). When such a
+ " line is selected in Terminal-Normal mode the Visual highlight must show on
+ " its first cell, while the rest of the line keeps the background color.
+ call writefile(["printf '\\033[100m\\033[K\\nold\\033[K\\n\\033[K\\033[0m\\n'"],
+ \ 'Xterm_colored.sh', 'D')
+ call writefile([':set listchars=', ':term sh ./Xterm_colored.sh'],
+ \ 'XtermColored', 'D')
+ let buf = RunVimInTerminal('-S XtermColored', #{rows: 10})
+ call term_wait(buf)
+
+ call term_sendkeys(buf, "\<C-W>NggVG")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_terminal_visual_colored_empty', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_terminal_ansi_color_windows_cui()
if !has('win32') || has('gui_running')
throw 'Skipped: only for the Windows CUI'