To: vim_dev@googlegroups.com Subject: Patch 8.1.1144 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1144 (after 8.1.1143) Problem: Too strict checking of the 'spellfile' option. Solution: Allow for a path. Files: src/option.c, src/testdir/test_spell.vim *** ../vim-8.1.1143/src/option.c 2019-04-10 22:15:15.813016799 +0200 --- src/option.c 2019-04-10 22:27:35.752196096 +0200 *************** *** 6040,6045 **** --- 6040,6059 ---- } /* + * 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,7110 **** else if (varp == &(curwin->w_s->b_p_spl) || varp == &(curwin->w_s->b_p_spf)) { ! if (!valid_spellang(*varp)) errmsg = e_invarg; else ! errmsg = did_set_spell_option(varp == &(curwin->w_s->b_p_spf)); } /* When 'spellcapcheck' is set compile the regexp program. */ else if (varp == &(curwin->w_s->b_p_spc)) --- 7115,7127 ---- else if (varp == &(curwin->w_s->b_p_spl) || varp == &(curwin->w_s->b_p_spf)) { ! 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(is_spellfile); } /* When 'spellcapcheck' is set compile the regexp program. */ else if (varp == &(curwin->w_s->b_p_spc)) *** ../vim-8.1.1143/src/testdir/test_spell.vim 2019-04-10 22:15:15.809016828 +0200 --- src/testdir/test_spell.vim 2019-04-10 22:25:18.728838835 +0200 *************** *** 376,381 **** --- 376,386 ---- call assert_equal("elekwint", SecondSpellWord()) endfunc + func Test_spellfile_value() + set spellfile=Xdir/Xtest.latin1.add + set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add + endfunc + func Test_region_error() messages clear call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add") *** ../vim-8.1.1143/src/version.c 2019-04-10 22:15:15.817016767 +0200 --- src/version.c 2019-04-10 22:28:01.352066486 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1144, /**/ -- hundred-and-one symptoms of being an internet addict: 240. You think Webster's Dictionary is a directory of WEB sites. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///