mirror of
https://github.com/neovim/neovim.git
synced 2025-11-16 07:11:20 +00:00
Merge pull request #23482 from zeertzjq/do-cmdline-verbose
fix(excmd): append original command to error message
This commit is contained in:
@@ -288,7 +288,7 @@ static void msg_verbose_cmd(linenr_T lnum, char *cmd)
|
|||||||
/// Execute a simple command line. Used for translated commands like "*".
|
/// Execute a simple command line. Used for translated commands like "*".
|
||||||
int do_cmdline_cmd(const char *cmd)
|
int do_cmdline_cmd(const char *cmd)
|
||||||
{
|
{
|
||||||
return do_cmdline((char *)cmd, NULL, NULL, DOCMD_NOWAIT|DOCMD_KEYTYPED);
|
return do_cmdline((char *)cmd, NULL, NULL, DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// do_cmdline(): execute one Ex command line
|
/// do_cmdline(): execute one Ex command line
|
||||||
@@ -1862,7 +1862,8 @@ static bool skip_cmd(const exarg_T *eap)
|
|||||||
|
|
||||||
/// Execute one Ex command.
|
/// Execute one Ex command.
|
||||||
///
|
///
|
||||||
/// If 'sourcing' is true, the command will be included in the error message.
|
/// If "flags" has DOCMD_VERBOSE, the command will be included in the error
|
||||||
|
/// message.
|
||||||
///
|
///
|
||||||
/// 1. skip comment lines and leading space
|
/// 1. skip comment lines and leading space
|
||||||
/// 2. handle command modifiers
|
/// 2. handle command modifiers
|
||||||
|
|||||||
@@ -361,6 +361,12 @@ describe('API', function()
|
|||||||
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
|
eq('', eval('v:errmsg')) -- v:errmsg was not updated.
|
||||||
eq('', eval('v:exception'))
|
eq('', eval('v:exception'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('gives E493 instead of prompting on backwards range', function()
|
||||||
|
command('split')
|
||||||
|
eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
|
||||||
|
pcall_err(command, '2,1windo echo'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('nvim_command_output', function()
|
describe('nvim_command_output', function()
|
||||||
|
|||||||
@@ -11,20 +11,24 @@ describe('Ex cmds', function()
|
|||||||
clear()
|
clear()
|
||||||
end)
|
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()
|
it('handle integer overflow from user-input #5555', function()
|
||||||
command(':9999999999999999999999999999999999999999')
|
command(':9999999999999999999999999999999999999999')
|
||||||
command(':later 9999999999999999999999999999999999999999')
|
command(':later 9999999999999999999999999999999999999999')
|
||||||
command(':echo expand("#<9999999999999999999999999999999999999999")')
|
command(':echo expand("#<9999999999999999999999999999999999999999")')
|
||||||
command(':lockvar 9999999999999999999999999999999999999999')
|
command(':lockvar 9999999999999999999999999999999999999999')
|
||||||
command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999')
|
command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999')
|
||||||
eq('Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999',
|
check_excmd_err(':tabnext 9999999999999999999999999999999999999999',
|
||||||
pcall_err(command, ':tabnext 9999999999999999999999999999999999999999'))
|
'Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999')
|
||||||
eq('Vim(Next):E939: Positive count required',
|
check_excmd_err(':N 9999999999999999999999999999999999999999',
|
||||||
pcall_err(command, ':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"',
|
eq('Vim(menu):E329: No menu "9999999999999999999999999999999999999999"',
|
||||||
pcall_err(command, ':menu 9999999999999999999999999999999999999999'))
|
pcall_err(command, ':menu 9999999999999999999999999999999999999999'))
|
||||||
eq('Vim(bdelete):E939: Positive count required',
|
|
||||||
pcall_err(command, ':bdelete 9999999999999999999999999999999999999999'))
|
|
||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ describe(':luado command', function()
|
|||||||
end)
|
end)
|
||||||
it('fails in sandbox when needed', function()
|
it('fails in sandbox when needed', function()
|
||||||
curbufmeths.set_lines(0, 1, false, {"ABC", "def", "gHi"})
|
curbufmeths.set_lines(0, 1, false, {"ABC", "def", "gHi"})
|
||||||
eq('Vim(luado):E48: Not allowed in sandbox',
|
eq('Vim(luado):E48: Not allowed in sandbox: sandbox luado runs = (runs or 0) + 1',
|
||||||
pcall_err(command, 'sandbox luado runs = (runs or 0) + 1'))
|
pcall_err(command, 'sandbox luado runs = (runs or 0) + 1'))
|
||||||
eq(NIL, funcs.luaeval('runs'))
|
eq(NIL, funcs.luaeval('runs'))
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1720,7 +1720,7 @@ describe("'inccommand' and :cnoremap", function()
|
|||||||
|
|
||||||
local function refresh(case, visual)
|
local function refresh(case, visual)
|
||||||
clear()
|
clear()
|
||||||
screen = visual and Screen.new(50,10) or nil
|
screen = visual and Screen.new(80,10) or nil
|
||||||
common_setup(screen, case, default_text)
|
common_setup(screen, case, default_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ local eval = helpers.eval
|
|||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
local pcall_err = helpers.pcall_err
|
||||||
local funcs = helpers.funcs
|
local funcs = helpers.funcs
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
@@ -284,6 +285,14 @@ describe('execute()', function()
|
|||||||
eq('42', eval('g:mes'))
|
eq('42', eval('g:mes'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('gives E493 instead of prompting on backwards range for ""', function()
|
||||||
|
command('split')
|
||||||
|
eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
|
||||||
|
pcall_err(funcs.execute, '2,1windo echo', ''))
|
||||||
|
eq('Vim(windo):E493: Backwards range given: 2,1windo echo',
|
||||||
|
pcall_err(funcs.execute, {'2,1windo echo'}, ''))
|
||||||
|
end)
|
||||||
|
|
||||||
it('captures but does not display output for "silent"', function()
|
it('captures but does not display output for "silent"', function()
|
||||||
local screen = Screen.new(40, 5)
|
local screen = Screen.new(40, 5)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
|||||||
Reference in New Issue
Block a user