diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-03 19:52:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-03 19:52:05 +0100 |
commit | e5a2dc87fd9d63dfd0d9c379e363ee8b8c05b14c (patch) | |
tree | 715a114546d458acfe85c5d0fe94fed963842ce9 /src/evalfunc.c | |
parent | 5afd081cd3d0f3dfbc7f6b157a8caad0ce6394ee (diff) | |
download | vim-git-e5a2dc87fd9d63dfd0d9c379e363ee8b8c05b14c.tar.gz |
patch 8.2.2289: Vim9: 'cpo' can become emptyv8.2.2289
Problem: Vim9: 'cpo' can become empty.
Solution: Use empty_option instead of an empty string. Update quickfix
buffer after restoring 'cpo'. (closes #7608)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 9b3b5beb6..07f1da9bb 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -6316,7 +6316,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; - p_cpo = (char_u *)""; + p_cpo = empty_option; rettv->vval.v_number = -1; if (type == MATCH_LIST || type == MATCH_POS) @@ -8024,8 +8024,14 @@ theend: if (p_cpo == empty_option) p_cpo = save_cpo; else + { // Darn, evaluating the {skip} expression 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 retval; } @@ -8723,7 +8729,7 @@ f_split(typval_T *argvars, typval_T *rettv) // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; - p_cpo = (char_u *)""; + p_cpo = empty_option; str = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) |