patch 9.1.0832: :set doesn't work for 'cot' and 'bkc' after :setlocal
Problem: :set doesn't work for 'cot' and 'bkc' after :setlocal.
Solution: clear the local flags when using :set (zeertzjq).
closes: #15981
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index df25484..8b478a1 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -875,6 +875,46 @@
call assert_equal('menu', &completeopt)
call assert_equal('menu', &g:completeopt)
+ new | only
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ set completeopt&
+ setlocal completeopt=menu,fuzzy,noinsert
+ setglobal completeopt=menu,longest
+ call assert_equal('menu,fuzzy,noinsert', &completeopt)
+ call assert_equal('menu,fuzzy,noinsert', &l:completeopt)
+ call assert_equal('menu,longest', &g:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>bz\<C-Y>", 'tnix')
+ call assert_equal('foobaz', getline('.'))
+ setlocal bufhidden=wipe
+ new | only!
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ call assert_equal('menu,longest', &completeopt)
+ call assert_equal('menu,longest', &g:completeopt)
+ call assert_equal('', &l:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-X>\<C-Z>", 'tnix')
+ call assert_equal('foo', getline('.'))
+ bwipe!
+
+ new | only
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ set completeopt&
+ setlocal completeopt=menu,fuzzy,noinsert
+ set completeopt=menu,longest
+ call assert_equal('menu,longest', &completeopt)
+ call assert_equal('menu,longest', &g:completeopt)
+ call assert_equal('', &l:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-X>\<C-Z>", 'tnix')
+ call assert_equal('foo', getline('.'))
+ setlocal bufhidden=wipe
+ new | only!
+ call setline(1, ['foofoo', 'foobar', 'foobaz', ''])
+ call assert_equal('menu,longest', &completeopt)
+ call assert_equal('menu,longest', &g:completeopt)
+ call assert_equal('', &l:completeopt)
+ call feedkeys("Gccf\<C-X>\<C-N>\<C-X>\<C-Z>", 'tnix')
+ call assert_equal('foo', getline('.'))
+ bwipe!
+
set completeopt&
endfunc