summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-10 22:33:41 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-10 22:33:41 +0200
commit862f1e17eaf2b9c6617dfba31d8487cde462658d (patch)
tree83d78e9b52ac6261ca0d157fffdd486d28c2cec0 /src/option.c
parent8f130eda4747e4a4d68353cdb650f359fd01469b (diff)
downloadvim-git-862f1e17eaf2b9c6617dfba31d8487cde462658d.tar.gz
patch 8.1.1144: too strict checking of the 'spellfile' optionv8.1.1144
Problem: Too strict checking of the 'spellfile' option. Solution: Allow for a path.
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/option.c b/src/option.c
index e4b1d5f43..b0fad01ed 100644
--- a/src/option.c
+++ b/src/option.c
@@ -6040,6 +6040,20 @@ valid_spellang(char_u *val)
}
/*
+ * Return TRUE if "val" is a valid 'spellfile' value.
+ */
+ static int
+valid_spellfile(char_u *val)
+{
+ char_u *s;
+
+ for (s = val; *s != NUL; ++s)
+ if (!vim_isfilec(*s) && *s != ',')
+ return FALSE;
+ return TRUE;
+}
+
+/*
* Handle string options that need some action to perform when changed.
* Returns NULL for success, or an error message for an error.
*/
@@ -7101,10 +7115,13 @@ did_set_string_option(
else if (varp == &(curwin->w_s->b_p_spl)
|| varp == &(curwin->w_s->b_p_spf))
{
- if (!valid_spellang(*varp))
+ int is_spellfile = varp == &(curwin->w_s->b_p_spf);
+
+ if ((is_spellfile && !valid_spellfile(*varp))
+ || (!is_spellfile && !valid_spellang(*varp)))
errmsg = e_invarg;
else
- errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf));
+ errmsg = did_set_spell_option(is_spellfile);
}
/* When 'spellcapcheck' is set compile the regexp program. */
else if (varp == &(curwin->w_s->b_p_spc))