aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-24 01:10:59 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-24 01:24:14 -0400
commit83c9d1df1b11326327c69cb009235a2e02fb31ed (patch)
treeef5b627b693239099ebcc3e0cbd7f560d7409c01 /src/nvim/testdir
parent9c437439452978fec4f858323e532b6cd4052608 (diff)
downloadrneovim-83c9d1df1b11326327c69cb009235a2e02fb31ed.tar.gz
rneovim-83c9d1df1b11326327c69cb009235a2e02fb31ed.tar.bz2
rneovim-83c9d1df1b11326327c69cb009235a2e02fb31ed.zip
vim-patch:8.0.1208: 'statusline' drops empty group with highlight change
Problem: 'statusline' drops empty group with highlight change. Solution: Do not drop an empty group if it changes highlighting. (Marius Gedminas, closes vim/vim#2228) https://github.com/vim/vim/commit/6b89dbb55f84c485310c8c9e094dbafe3ecbace6
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_statusline.vim65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim
index 351b119acd..de943f2466 100644
--- a/src/nvim/testdir/test_statusline.vim
+++ b/src/nvim/testdir/test_statusline.vim
@@ -5,7 +5,6 @@
" %N
" %T
" %X
-" %*
source view_util.vim
@@ -249,6 +248,70 @@ func Test_statusline()
call assert_equal(sa1, sa3)
call assert_notequal(sa1, sa2)
+ " An empty group that contains highlight changes
+ let g:a = ''
+ set statusline=ab%(cd%1*%{g:a}%*%)de
+ call assert_match('^abde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 4)
+ call assert_equal(sa1, sa2)
+ let g:a = 'X'
+ call assert_match('^abcdXde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 5)
+ let sa3=screenattr(&lines - 1, 7)
+ call assert_equal(sa1, sa3)
+ call assert_notequal(sa1, sa2)
+
+ let g:a = ''
+ set statusline=ab%1*%(cd%*%{g:a}%1*%)de
+ call assert_match('^abde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 4)
+ call assert_notequal(sa1, sa2)
+ let g:a = 'X'
+ call assert_match('^abcdXde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 3)
+ let sa3=screenattr(&lines - 1, 5)
+ let sa4=screenattr(&lines - 1, 7)
+ call assert_notequal(sa1, sa2)
+ call assert_equal(sa1, sa3)
+ call assert_equal(sa2, sa4)
+
+ " An empty group that contains highlight changes and doesn't reset them
+ let g:a = ''
+ set statusline=ab%(cd%1*%{g:a}%)de
+ call assert_match('^abcdde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 5)
+ call assert_notequal(sa1, sa2)
+ let g:a = 'X'
+ call assert_match('^abcdXde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 5)
+ let sa3=screenattr(&lines - 1, 7)
+ call assert_notequal(sa1, sa2)
+ call assert_equal(sa2, sa3)
+
+ let g:a = ''
+ set statusline=ab%1*%(cd%*%{g:a}%)de
+ call assert_match('^abcdde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 3)
+ let sa3=screenattr(&lines - 1, 5)
+ call assert_notequal(sa1, sa2)
+ call assert_equal(sa1, sa3)
+ let g:a = 'X'
+ call assert_match('^abcdXde\s*$', s:get_statusline())
+ let sa1=screenattr(&lines - 1, 1)
+ let sa2=screenattr(&lines - 1, 3)
+ let sa3=screenattr(&lines - 1, 5)
+ let sa4=screenattr(&lines - 1, 7)
+ call assert_notequal(sa1, sa2)
+ call assert_equal(sa1, sa3)
+ call assert_equal(sa1, sa4)
+
" %%: a percent sign.
set statusline=10%%
call assert_match('^10%\s*$', s:get_statusline())