aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-07 17:11:03 +0800
committerGitHub <noreply@github.com>2022-08-07 17:11:03 +0800
commitfa8b2b4c50c089804a57f77aed6650b7e4c3f0cc (patch)
treeabda483e43a0ff4d5df5283fcd9c9a6f2edea34d /src
parentfea15adad394619aaea69b627be249f8a20dc2ed (diff)
downloadrneovim-fa8b2b4c50c089804a57f77aed6650b7e4c3f0cc.tar.gz
rneovim-fa8b2b4c50c089804a57f77aed6650b7e4c3f0cc.tar.bz2
rneovim-fa8b2b4c50c089804a57f77aed6650b7e4c3f0cc.zip
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) https://github.com/vim/vim/commit/8ccbbeb620dcc73154de29c51100fe815cefe109
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/vars.c5
-rw-r--r--src/nvim/testdir/test_normal.vim3
-rw-r--r--src/nvim/testdir/test_options.vim2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 033b6094b4..cf2755f639 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -678,8 +678,11 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
if (!failed) {
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;
+ if (err != NULL) {
+ emsg(_(err));
+ }
} else {
emsg(_(e_stringreq));
}
diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim
index f18ddb274c..7cb70aa2af 100644
--- a/src/nvim/testdir/test_normal.vim
+++ b/src/nvim/testdir/test_normal.vim
@@ -1975,7 +1975,8 @@ func Test_normal31_r_cmd()
" using CTRL-Y and CTRL-E.
" Different code paths are used for utf-8 and latin1 encodings
set showmatch
- for enc in ['latin1', 'utf-8']
+ " for enc in ['latin1', 'utf-8']
+ for enc in ['utf-8']
enew!
let &encoding = enc
call setline(1, [' {a}', 'xxxxxxxxxx', ' [b]'])
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index c5b1266689..b10f0f5030 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -310,6 +310,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:')
@@ -325,6 +326,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:')