aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-26 20:40:12 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-26 20:41:51 -0500
commit90f2b1360469821dfd0e7e75d0b43859aa27dac1 (patch)
tree5cdc80ca1a4442a573bf73ef451227ca21e616a1
parentf196ab87a1b5a9da1326d4de883ab7e97a0bb1f0 (diff)
downloadrneovim-90f2b1360469821dfd0e7e75d0b43859aa27dac1.tar.gz
rneovim-90f2b1360469821dfd0e7e75d0b43859aa27dac1.tar.bz2
rneovim-90f2b1360469821dfd0e7e75d0b43859aa27dac1.zip
vim-patch:8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif"
Problem: :lockvar and :unlockvar cannot be followed by "| endif". Solution: Check for following commands. (closes vim/vim#5269) https://github.com/vim/vim/commit/cc4423ae13d78367a3d0b5756783523d3b3a1d31
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/testdir/test_const.vim14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index b24bf119b3..743286c64a 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2151,6 +2151,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case CMD_leftabove:
case CMD_let:
case CMD_lockmarks:
+ case CMD_lockvar:
case CMD_lua:
case CMD_match:
case CMD_mzscheme:
@@ -2179,6 +2180,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case CMD_tilde:
case CMD_topleft:
case CMD_unlet:
+ case CMD_unlockvar:
case CMD_verbose:
case CMD_vertical:
case CMD_wincmd:
diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim
index 1d7b0a56b5..eaf200e9bb 100644
--- a/src/nvim/testdir/test_const.vim
+++ b/src/nvim/testdir/test_const.vim
@@ -182,6 +182,20 @@ func Test_const_with_condition()
call assert_equal(0, x)
endfunc
+func Test_lockvar()
+ let x = 'hello'
+ lockvar x
+ call assert_fails('let x = "there"', 'E741')
+ if 0 | unlockvar x | endif
+ call assert_fails('let x = "there"', 'E741')
+ unlockvar x
+ let x = 'there'
+
+ if 0 | lockvar x | endif
+ let x = 'again'
+endfunc
+
+
func Test_const_with_index_access()
let l = [1, 2, 3]
call assert_fails('const l[0] = 4', 'E996:')