forked from aniani/vim
patch 8.2.2289: Vim9: 'cpo' can become empty
Problem: Vim9: 'cpo' can become empty. Solution: Use empty_option instead of an empty string. Update quickfix buffer after restoring 'cpo'. (closes #7608)
This commit is contained in:
@@ -1940,7 +1940,7 @@ pattern_match(char_u *pat, char_u *text, int ic)
|
||||
|
||||
// avoid 'l' flag in 'cpoptions'
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = (char_u *)"";
|
||||
p_cpo = empty_option;
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
|
||||
if (regmatch.regprog != NULL)
|
||||
{
|
||||
@@ -6200,8 +6200,14 @@ do_string_sub(
|
||||
if (p_cpo == empty_option)
|
||||
p_cpo = save_cpo;
|
||||
else
|
||||
{
|
||||
// Darn, evaluating {sub} expression or {expr} changed the value.
|
||||
// If it's still empty it was changed and restored, need to restore in
|
||||
// the complicated way.
|
||||
if (*p_cpo == NUL)
|
||||
set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
|
||||
free_string_option(save_cpo);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user