aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-06 12:24:24 -0500
committerGitHub <noreply@github.com>2021-02-06 12:24:24 -0500
commit336eb70822970cea6797251043158ee6bd76bc69 (patch)
treef2f89448e8b217884ffeebd8999ee7c9cd605085 /src
parente455f0ba2dc278e4374098c60afa79e1abd3bd3b (diff)
downloadrneovim-336eb70822970cea6797251043158ee6bd76bc69.tar.gz
rneovim-336eb70822970cea6797251043158ee6bd76bc69.tar.bz2
rneovim-336eb70822970cea6797251043158ee6bd76bc69.zip
vim-patch:8.2.2469: confusing error if :winsize has a wrong argument (#13889)
Problem: Confusing error if :winsize has a wrong argument. Solution: Quote the argument in the error. (closes vim/vim#2523) https://github.com/vim/vim/commit/f5a5116a96b1877c3f44e7bae288fd6603151eb1 Cherry-pick Test_winsize_cmd() from patch v8.2.0243.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c5
-rw-r--r--src/nvim/testdir/test_excmd.vim8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 52da7fe4f6..f55344e77e 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7756,6 +7756,11 @@ static void do_exmap(exarg_T *eap, int isabbrev)
static void ex_winsize(exarg_T *eap)
{
char_u *arg = eap->arg;
+
+ if (!ascii_isdigit(*arg)) {
+ EMSG2(_(e_invarg2), arg);
+ return;
+ }
int w = getdigits_int(&arg, false, 10);
arg = skipwhite(arg);
char_u *p = arg;
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim
index 20508b12d3..98a3e60368 100644
--- a/src/nvim/testdir/test_excmd.vim
+++ b/src/nvim/testdir/test_excmd.vim
@@ -131,3 +131,11 @@ func Test_confirm_cmd_cancel()
\ term_getline(buf, 20))}, 1000)
call StopVimInTerminal(buf)
endfunc
+
+" Test for the :winsize command
+func Test_winsize_cmd()
+ call assert_fails('winsize 1', 'E465:')
+ call assert_fails('winsize 1 x', 'E465:')
+ call assert_fails('win_getid(1)', 'E475: Invalid argument: _getid(1)')
+ " Actually changing the window size would be flaky.
+endfunc