Mercurial > vim
changeset 27934:c8d6c2736796 v8.2.4492
patch 8.2.4492: no error if an option is given a value with ":let &opt = val"
Commit: https://github.com/vim/vim/commit/8ccbbeb620dcc73154de29c51100fe815cefe109
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 2 19:49:38 2022 +0000
patch 8.2.4492: no error if an option is given a value with ":let &opt = val"
Problem: No error if an option is given an invalid value with
":let &opt = val".
Solution: Give the error. (closes #9864)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Mar 2022 21:00:02 +0100 |
parents | e3e513338e4b |
children | 457a7fd87147 |
files | src/evalvars.c src/testdir/test_options.vim src/version.c |
diffstat | 3 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -1518,8 +1518,11 @@ ex_let_option( { if (opt_type != gov_string || s != NULL) { - set_option_value(arg, n, s, scope); + char *err = set_option_value(arg, n, s, scope); + arg_end = p; + if (err != NULL) + emsg(_(err)); } else emsg(_(e_string_required));
--- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -369,6 +369,7 @@ func Test_set_errors() call assert_fails('set sidescroll=-1', 'E487:') call assert_fails('set tabstop=-1', 'E487:') 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 textwidth=-1', 'E487:') call assert_fails('set timeoutlen=-1', 'E487:') @@ -384,6 +385,7 @@ func Test_set_errors() call assert_fails('set comments=a', 'E525:') call assert_fails('set foldmarker=x', 'E536:') 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 rulerformat=%-', 'E539:') call assert_fails('set rulerformat=%(', 'E542:')