summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1144
blob: 0d4771ccc76fc09053cb719d79ab246f6ad3ec5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1144
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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    ///