mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:8.2.4492: no error if an option is given a value with ":let &opt = val" (#19670)
Problem:    No error if an option is given an invalid value with
            ":let &opt = val".
Solution:   Give the error. (closes vim/vim#9864)
8ccbbeb620
			
			
This commit is contained in:
		@@ -678,8 +678,11 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      if (!failed) {
 | 
					      if (!failed) {
 | 
				
			||||||
        if (opt_type != gov_string || s != NULL) {
 | 
					        if (opt_type != gov_string || s != NULL) {
 | 
				
			||||||
          set_option_value(arg, n, s, opt_flags);
 | 
					          char *err = set_option_value(arg, n, s, opt_flags);
 | 
				
			||||||
          arg_end = p;
 | 
					          arg_end = p;
 | 
				
			||||||
 | 
					          if (err != NULL) {
 | 
				
			||||||
 | 
					            emsg(_(err));
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          emsg(_(e_stringreq));
 | 
					          emsg(_(e_stringreq));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1975,7 +1975,8 @@ func Test_normal31_r_cmd()
 | 
				
			|||||||
  " using CTRL-Y and CTRL-E.
 | 
					  " using CTRL-Y and CTRL-E.
 | 
				
			||||||
  " Different code paths are used for utf-8 and latin1 encodings
 | 
					  " Different code paths are used for utf-8 and latin1 encodings
 | 
				
			||||||
  set showmatch
 | 
					  set showmatch
 | 
				
			||||||
  for enc in ['latin1', 'utf-8']
 | 
					  " for enc in ['latin1', 'utf-8']
 | 
				
			||||||
 | 
					  for enc in ['utf-8']
 | 
				
			||||||
    enew!
 | 
					    enew!
 | 
				
			||||||
    let &encoding = enc
 | 
					    let &encoding = enc
 | 
				
			||||||
    call setline(1, [' {a}', 'xxxxxxxxxx', '      [b]'])
 | 
					    call setline(1, [' {a}', 'xxxxxxxxxx', '      [b]'])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -310,6 +310,7 @@ func Test_set_errors()
 | 
				
			|||||||
  call assert_fails('set sidescroll=-1', 'E487:')
 | 
					  call assert_fails('set sidescroll=-1', 'E487:')
 | 
				
			||||||
  call assert_fails('set tabstop=-1', 'E487:')
 | 
					  call assert_fails('set tabstop=-1', 'E487:')
 | 
				
			||||||
  call assert_fails('set tabstop=10000', 'E474:')
 | 
					  call assert_fails('set tabstop=10000', 'E474:')
 | 
				
			||||||
 | 
					  call assert_fails('let &tabstop = 10000', 'E474:')
 | 
				
			||||||
  call assert_fails('set tabstop=5500000000', 'E474:')
 | 
					  call assert_fails('set tabstop=5500000000', 'E474:')
 | 
				
			||||||
  call assert_fails('set textwidth=-1', 'E487:')
 | 
					  call assert_fails('set textwidth=-1', 'E487:')
 | 
				
			||||||
  call assert_fails('set timeoutlen=-1', 'E487:')
 | 
					  call assert_fails('set timeoutlen=-1', 'E487:')
 | 
				
			||||||
@@ -325,6 +326,7 @@ func Test_set_errors()
 | 
				
			|||||||
  call assert_fails('set comments=a', 'E525:')
 | 
					  call assert_fails('set comments=a', 'E525:')
 | 
				
			||||||
  call assert_fails('set foldmarker=x', 'E536:')
 | 
					  call assert_fails('set foldmarker=x', 'E536:')
 | 
				
			||||||
  call assert_fails('set commentstring=x', 'E537:')
 | 
					  call assert_fails('set commentstring=x', 'E537:')
 | 
				
			||||||
 | 
					  call assert_fails('let &commentstring = "x"', 'E537:')
 | 
				
			||||||
  call assert_fails('set complete=x', 'E539:')
 | 
					  call assert_fails('set complete=x', 'E539:')
 | 
				
			||||||
  call assert_fails('set rulerformat=%-', 'E539:')
 | 
					  call assert_fails('set rulerformat=%-', 'E539:')
 | 
				
			||||||
  call assert_fails('set rulerformat=%(', 'E542:')
 | 
					  call assert_fails('set rulerformat=%(', 'E542:')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user