]> granicus.if.org Git - vim/commitdiff
patch 8.2.2469: confusing error if :winsize has a wrong argument v8.2.2469
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 11:58:18 +0000 (12:58 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2021 11:58:18 +0000 (12:58 +0100)
Problem:    Confusing error if :winsize has a wrong argument.
Solution:   Quote the argument in the error. (closes #2523)

src/ex_docmd.c
src/testdir/test_excmd.vim
src/version.c

index da499c9e4af16902a5aca33e6c7ce99393c9e74b..a2e53ad349440da7f577213e88039eecb0a63faf 100644 (file)
@@ -7347,6 +7347,11 @@ ex_winsize(exarg_T *eap)
     char_u     *arg = eap->arg;
     char_u     *p;
 
+    if (!isdigit(*arg))
+    {
+       semsg(_(e_invarg2), arg);
+       return;
+    }
     w = getdigits(&arg);
     arg = skipwhite(arg);
     p = arg;
index 150e258ac7bf9c15db466e8ce231e4fa03d5348c..f27b38562fb1054a81e8c4493a4253ac919747f2 100644 (file)
@@ -327,6 +327,9 @@ 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
 
 " Test for the :redir command
index e8c286b107ab2c393e33ab3e804dfa04971b13ed..fb3a50ac6db113c3899f0d401209cb9c8b84f9ee 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2469,
 /**/
     2468,
 /**/