Commit: patch 9.1.1489: terminal: no visual highlight of empty cols with empty 'listchars'

1 view
Skip to first unread message

Christian Brabandt

unread,
Jun 28, 2025, 1:00:14 PM6/28/25
to vim...@googlegroups.com
patch 9.1.1489: terminal: no visual highlight of empty cols with empty 'listchars'

Commit: https://github.com/vim/vim/commit/a899b27206a27b2222fe7d20fd8b01f6cb69c3ef
Author: Christian Brabandt <c...@256bit.org>
Date: Sat Jun 28 18:40:15 2025 +0200

patch 9.1.1489: terminal: no visual highlight of empty cols with empty 'listchars'

Problem: terminal: no visual highlight of empty cols when 'listchars'
is empty (Yousef Mohammed)
Solution: reset wlv.win_attr when column is zero and we are drawing a
terminal buffer

fixes: #17559
closes: #17618

Co-authored-by: Hirohito Higashi <h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/drawline.c b/src/drawline.c
index 84a1d895b..afc048091 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2772,6 +2772,13 @@ win_line(
#endif
// no more cells to skip
skip_cells = 0;
+#ifdef FEAT_TERMINAL
+ if (term_show_buffer(wp->w_buffer)
+ && wlv.col == 0
+ && wlv.win_attr == term_get_attr(wp, lnum, -1))
+ // reset highlighting attribute
+ wlv.win_attr = 0;
+#endif
}

if (has_mbyte)
diff --git a/src/testdir/dumps/Test_terminal_empty_listchars.dump b/src/testdir/dumps/Test_terminal_empty_listchars.dump
new file mode 100644
index 000000000..b22ebf953
--- /dev/null
+++ b/src/testdir/dumps/Test_terminal_empty_listchars.dump
@@ -0,0 +1,15 @@
+>h+0&#ffffff0|e+0#0000001#a8a8a8255|l@1|o| +0#0000000#ffffff0@69
+| +0#0000001#a8a8a8255| +0#0000000#ffffff0@73
+|h+0#0000001#a8a8a8255|e|l@1|o| +0#0000000#ffffff0@69
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|!+2#ffffff16#00e0003|s|h| |-|c| |"|p|r|i|n|t|f| |'|h|e|l@1|o|\@1|n|\@1|n|h|e|l@1|o|'|"| |[|f|i|n|i|s|h|e|d|]| @11|1|,|1| @11|A|l@1
+| +0#0000000#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @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|3| @9
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim
index 64b8ac8a3..9aa90492c 100644
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -1018,4 +1018,22 @@ func Test_autocmd_buffilepost_with_hidden_term()
bw! XTestFile
endfunc

+func Test_terminal_visual_empty_listchars()
+ CheckScreendump
+ CheckRunVimInTerminal
+ CheckUnix
+
+ let lines = [
+ \ 'set listchars=',
+ \ ':term sh -c "printf ''hello\n\nhello''"'
+ \ ]
+ call writefile(lines, 'XtermStart1', 'D')
+ let buf = RunVimInTerminal('-S XtermStart1', #{rows: 15})
+ call term_wait(buf)
+ call term_sendkeys(buf, "V2k")
+ call VerifyScreenDump(buf, 'Test_terminal_empty_listchars', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 8e6849ae1..e91207032 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1489,
/**/
1488,
/**/
Reply all
Reply to author
Forward
0 new messages