From 4453d4c9f1e2cb93bf42e24a622ff00134d7229f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 5 Dec 2021 21:57:22 -0500 Subject: vim-patch:8.2.3747: cannot remove highlight from an existing sign Problem: Cannot remove highlight from an existing sign. (James McCoy) Solution: Only reject empty argument for a new sign. https://github.com/vim/vim/commit/0bac5fc5e125b7aa0f3b596c9b7f4381279e6688 --- src/nvim/testdir/test_signs.vim | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 3afabfa959..c570d2c37e 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -126,9 +126,34 @@ func Test_sign() " call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:') call assert_fails("sign define Sign4 text=\\ ab linehl=Comment", 'E239:') - call assert_fails("sign define Sign4 linehl=", 'E1249: Group name missing for linehl') - call assert_fails("sign define Sign4 culhl=", 'E1249: Group name missing for culhl') - call assert_fails("sign define Sign4 texthl=", 'E1249: Group name missing for texthl') + " an empty highlight argument for a new sign is an error + call assert_fails("sign define SignX linehl=", 'E1249: Group name missing for linehl') + call assert_fails("sign define SignX culhl=", 'E1249: Group name missing for culhl') + call assert_fails("sign define SignX texthl=", 'E1249: Group name missing for texthl') + + " an empty highlight argument for an existing sign clears it + sign define SignY texthl=TextHl culhl=CulHl linehl=LineHl + let sl = sign_getdefined('SignY')[0] + call assert_equal('TextHl', sl.texthl) + call assert_equal('CulHl', sl.culhl) + call assert_equal('LineHl', sl.linehl) + + sign define SignY texthl= culhl=CulHl linehl=LineHl + let sl = sign_getdefined('SignY')[0] + call assert_false(has_key(sl, 'texthl')) + call assert_equal('CulHl', sl.culhl) + call assert_equal('LineHl', sl.linehl) + + sign define SignY linehl= + let sl = sign_getdefined('SignY')[0] + call assert_false(has_key(sl, 'linehl')) + call assert_equal('CulHl', sl.culhl) + + sign define SignY culhl= + let sl = sign_getdefined('SignY')[0] + call assert_false(has_key(sl, 'culhl')) + + sign undefine SignY " define sign with whitespace sign define Sign4 text=\ X linehl=Comment -- cgit