When running 'helpgrep', if an autocmd modifies 'cpo' then Vim crashes

6 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Feb 23, 2022, 12:02:23 AM2/23/22
to vim_dev
Hi all,

When running the 'helpgrep' command if an autocmd modifies the 'cpo' option,
then Vim crashes. This issue was reported back in 2008:

https://groups.google.com/g/vim_dev/c/_xIqgmPwZYM/m/fAZNMm8OOzsJ

This was supposed to be fixed by 7.2b-004:

https://groups.google.com/g/vim_dev/c/yH1xPvbUeFw/m/ljDl2ZRNdTsJ

But I am still able to reproduce this crash using the following test function:

-------------------------------------------------------------
func Test_helpgrep_restore_cpo()
let save_cpo = &cpo
augroup QF_Test
au!
autocmd BufNew * set cpo=acd
augroup END

helpgrep quickfix
call assert_equal('acd', &cpo)
%bw!

set cpo&vim
augroup QF_Test
au!
autocmd BufNew * set cpo=
augroup END

helpgrep buffer
call assert_equal('', &cpo)

augroup QF_Test
au!
augroup END
%bw!
let &cpo = save_cpo
endfunc
-------------------------------------------------------------

Regards,
Yegappan
Reply all
Reply to author
Forward
0 new messages