changeset 23855:a7098bc3810e v8.2.2469

patch 8.2.2469: confusing error if :winsize has a wrong argument Commit: https://github.com/vim/vim/commit/f5a5116a96b1877c3f44e7bae288fd6603151eb1 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 6 12:58:18 2021 +0100 patch 8.2.2469: confusing error if :winsize has a wrong argument Problem: Confusing error if :winsize has a wrong argument. Solution: Quote the argument in the error. (closes https://github.com/vim/vim/issues/2523)
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Feb 2021 13:00:03 +0100
parents d66967ef351c
children 6f1eb8fe8b9b
files src/ex_docmd.c src/testdir/test_excmd.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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;
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2469,
+/**/
     2468,
 /**/
     2467,