diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-14 06:09:53 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-07-14 06:12:42 +0800 |
commit | 3700d94c6fa3c6e2a58fc02414e4ca32b823214f (patch) | |
tree | 1a79b63b55e11ffb7c314eceeaa0e6bcb5a9a78e | |
parent | 5531c95101b7656416c97acdd4acb3173d09f64c (diff) | |
download | rneovim-3700d94c6fa3c6e2a58fc02414e4ca32b823214f.tar.gz rneovim-3700d94c6fa3c6e2a58fc02414e4ca32b823214f.tar.bz2 rneovim-3700d94c6fa3c6e2a58fc02414e4ca32b823214f.zip |
vim-patch:9.1.0579: Ex command is still executed after giving E1247
Problem: Ex command is still executed after giving E1247.
Solution: Indicate the error properly and set cmd to NULL.
(zeertzjq)
closes: vim/vim#15241
https://github.com/vim/vim/commit/d1b5ea984d41102d253ecdd9a76124cd4c58b97d
-rw-r--r-- | src/nvim/ex_docmd.c | 2 | ||||
-rw-r--r-- | test/old/testdir/test_excmd.vim | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 63e7a80e53..44a9c07ec8 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3619,6 +3619,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, bool n = getdigits_int32(&cmd, false, MAXLNUM); if (n == MAXLNUM) { *errormsg = _(e_line_number_out_of_range); + cmd = NULL; goto error; } } @@ -3641,6 +3642,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, bool } else { if (lnum >= 0 && n >= INT32_MAX - lnum) { *errormsg = _(e_line_number_out_of_range); + cmd = NULL; goto error; } lnum += n; diff --git a/test/old/testdir/test_excmd.vim b/test/old/testdir/test_excmd.vim index d900207928..50e5080f60 100644 --- a/test/old/testdir/test_excmd.vim +++ b/test/old/testdir/test_excmd.vim @@ -725,6 +725,8 @@ func Test_address_line_overflow() call setline(1, range(100)) call assert_fails('|.44444444444444444444444', 'E1247:') call assert_fails('|.9223372036854775806', 'E1247:') + call assert_fails('.44444444444444444444444d', 'E1247:') + call assert_equal(range(100)->map('string(v:val)'), getline(1, '$')) $ yank 77777777777777777777 |