fix(excmd): append original command to error message

Revert the change to do_cmdline_cmd() from #5226.

This function is used in many places, so making it different from Vim
leads to small differences from Vim in the behavior of some functions
like execute() and assert_fails(). If DOCMD_VERBOSE really needs to be
removed somewhere, a do_cmdline() call without DOCMD_VERBOSE is also
shorter than a do_cmdline() call with DOCMD_VERBOSE.
This commit is contained in:
zeertzjq
2023-05-05 06:32:17 +08:00
parent 9ded4c1275
commit 4a098b97e5
4 changed files with 15 additions and 10 deletions

View File

@@ -11,20 +11,24 @@ describe('Ex cmds', function()
clear()
end)
local function check_excmd_err(cmd, err)
eq(err .. ': ' .. cmd, pcall_err(command, cmd))
end
it('handle integer overflow from user-input #5555', function()
command(':9999999999999999999999999999999999999999')
command(':later 9999999999999999999999999999999999999999')
command(':echo expand("#<9999999999999999999999999999999999999999")')
command(':lockvar 9999999999999999999999999999999999999999')
command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999')
eq('Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999',
pcall_err(command, ':tabnext 9999999999999999999999999999999999999999'))
eq('Vim(Next):E939: Positive count required',
pcall_err(command, ':N 9999999999999999999999999999999999999999'))
check_excmd_err(':tabnext 9999999999999999999999999999999999999999',
'Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999')
check_excmd_err(':N 9999999999999999999999999999999999999999',
'Vim(Next):E939: Positive count required')
check_excmd_err(':bdelete 9999999999999999999999999999999999999999',
'Vim(bdelete):E939: Positive count required')
eq('Vim(menu):E329: No menu "9999999999999999999999999999999999999999"',
pcall_err(command, ':menu 9999999999999999999999999999999999999999'))
eq('Vim(bdelete):E939: Positive count required',
pcall_err(command, ':bdelete 9999999999999999999999999999999999999999'))
assert_alive()
end)