From c40bb2de7ac5cfb3e2b6d45591f0fea8642be1cd Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 25 Feb 2020 23:03:14 -0500 Subject: vim-patch:8.1.0939: no completion for sign group names Problem: No completion for sign group names. Solution: Add completion for sign group names and buffer names. (Yegappan Lakshmanan, closes vim/vim#3980) https://github.com/vim/vim/commit/3678f65d43d10b36dc62738aab2f341fa1e18a32 --- src/nvim/testdir/test_signs.vim | 66 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index dcbb546a2e..b80e41bd0c 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -212,13 +212,16 @@ func Test_sign_completion() call assert_equal('"sign define Sign linehl=SpellBad SpellCap ' . \ 'SpellLocal SpellRare', @:) - call writefile(['foo'], 'XsignOne') - call writefile(['bar'], 'XsignTwo') + call feedkeys(":sign define Sign texthl=Spell\\\"\", 'tx') + call assert_equal('"sign define Sign texthl=SpellBad SpellCap ' . + \ 'SpellLocal SpellRare', @:) + + call writefile(repeat(["Sun is shining"], 30), "XsignOne") + call writefile(repeat(["Sky is blue"], 30), "XsignTwo") call feedkeys(":sign define Sign icon=Xsig\\\"\", 'tx') call assert_equal('"sign define Sign icon=XsignOne XsignTwo', @:) - call delete('XsignOne') - call delete('XsignTwo') + " Test for completion of arguments to ':sign undefine' call feedkeys(":sign undefine \\\"\", 'tx') call assert_equal('"sign undefine Sign1 Sign2', @:) @@ -229,17 +232,70 @@ func Test_sign_completion() call feedkeys(":sign place 1 name=\\\"\", 'tx') call assert_equal('"sign place 1 name=Sign1 Sign2', @:) + edit XsignOne + sign place 1 name=Sign1 line=5 + sign place 1 name=Sign1 group=g1 line=10 + edit XsignTwo + sign place 1 name=Sign2 group=g2 line=15 + + " Test for completion of group= and file= arguments to ':sign place' + call feedkeys(":sign place 1 name=Sign1 file=Xsign\\\"\", 'tx') + call assert_equal('"sign place 1 name=Sign1 file=XsignOne XsignTwo', @:) + call feedkeys(":sign place 1 name=Sign1 group=\\\"\", 'tx') + call assert_equal('"sign place 1 name=Sign1 group=g1 g2', @:) + + " Test for completion of arguments to 'sign place' without sign identifier + call feedkeys(":sign place \\\"\", 'tx') + call assert_equal('"sign place buffer= file= group=', @:) + call feedkeys(":sign place file=Xsign\\\"\", 'tx') + call assert_equal('"sign place file=XsignOne XsignTwo', @:) + call feedkeys(":sign place group=\\\"\", 'tx') + call assert_equal('"sign place group=g1 g2', @:) + call feedkeys(":sign place group=g1 file=\\\"\", 'tx') + call assert_equal('"sign place group=g1 file=XsignOne XsignTwo', @:) + + " Test for completion of arguments to ':sign unplace' call feedkeys(":sign unplace 1 \\\"\", 'tx') call assert_equal('"sign unplace 1 buffer= file= group=', @:) - + call feedkeys(":sign unplace 1 file=Xsign\\\"\", 'tx') + call assert_equal('"sign unplace 1 file=XsignOne XsignTwo', @:) + call feedkeys(":sign unplace 1 group=\\\"\", 'tx') + call assert_equal('"sign unplace 1 group=g1 g2', @:) + call feedkeys(":sign unplace 1 group=g2 file=Xsign\\\"\", 'tx') + call assert_equal('"sign unplace 1 group=g2 file=XsignOne XsignTwo', @:) + + " Test for completion of arguments to ':sign list' call feedkeys(":sign list \\\"\", 'tx') call assert_equal('"sign list Sign1 Sign2', @:) + " Test for completion of arguments to ':sign jump' call feedkeys(":sign jump 1 \\\"\", 'tx') call assert_equal('"sign jump 1 buffer= file= group=', @:) + call feedkeys(":sign jump 1 file=Xsign\\\"\", 'tx') + call assert_equal('"sign jump 1 file=XsignOne XsignTwo', @:) + call feedkeys(":sign jump 1 group=\\\"\", 'tx') + call assert_equal('"sign jump 1 group=g1 g2', @:) + " Error cases + call feedkeys(":sign here\\\"\", 'tx') + call assert_equal('"sign here', @:) + call feedkeys(":sign define Sign here=\\\"\", 'tx') + call assert_equal("\"sign define Sign here=\", @:) + call feedkeys(":sign place 1 here=\\\"\", 'tx') + call assert_equal("\"sign place 1 here=\", @:) + call feedkeys(":sign jump 1 here=\\\"\", 'tx') + call assert_equal("\"sign jump 1 here=\", @:) + call feedkeys(":sign here there\\\"\", 'tx') + call assert_equal("\"sign here there\", @:) + call feedkeys(":sign here there=\\\"\", 'tx') + call assert_equal("\"sign here there=\", @:) + + sign unplace * group=* sign undefine Sign1 sign undefine Sign2 + enew + call delete('XsignOne') + call delete('XsignTwo') endfunc func Test_sign_invalid_commands() -- cgit