mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
vim-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: vim/vim#15981
46dcd84d24
This commit is contained in:
parent
99acc9de55
commit
981fa11c91
@ -655,6 +655,9 @@ const char *did_set_backupcopy(optset_T *args)
|
||||
if (opt_flags & OPT_LOCAL) {
|
||||
bkc = buf->b_p_bkc;
|
||||
flags = &buf->b_bkc_flags;
|
||||
} else if (!(opt_flags & OPT_GLOBAL)) {
|
||||
// When using :set, clear the local flags.
|
||||
buf->b_bkc_flags = 0;
|
||||
}
|
||||
|
||||
if ((opt_flags & OPT_LOCAL) && *bkc == NUL) {
|
||||
@ -1070,6 +1073,9 @@ const char *did_set_completeopt(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (args->os_flags & OPT_LOCAL) {
|
||||
cot = buf->b_p_cot;
|
||||
flags = &buf->b_cot_flags;
|
||||
} else if (!(args->os_flags & OPT_GLOBAL)) {
|
||||
// When using :set, clear the local flags.
|
||||
buf->b_cot_flags = 0;
|
||||
}
|
||||
|
||||
if (check_opt_strings(cot, p_cot_values, true) != OK) {
|
||||
|
@ -950,6 +950,46 @@ func Test_completeopt_buffer_local()
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user