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)
f5a5116a96

Cherry-pick Test_winsize_cmd() from patch v8.2.0243.
This commit is contained in:
Jan Edmund Lazo 2021-02-06 12:24:24 -05:00 committed by GitHub
parent e455f0ba2d
commit 336eb70822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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