diff options
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 1 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 32 |
4 files changed, 37 insertions, 6 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index bd61d113fb..beb5e9f4c2 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6505,7 +6505,9 @@ A jump table for the options with a short description can be found at |Q_op|. >= 12 Every executed function. >= 13 When an exception is thrown, caught, finished, or discarded. >= 14 Anything pending in a ":finally" clause. - >= 15 Every executed Ex command (truncated at 200 characters). + >= 15 Every executed Ex command from a script (truncated at 200 + characters). + >= 16 Every executed Ex command This option can also be set with the "-V" argument. See |-V|. This option is also set by the |:verbose| command. diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index a4ed86e4c0..ccaa0b0e52 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -588,7 +588,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, } } - if (p_verbose >= 15 && sourcing_name != NULL) { + if ((p_verbose >= 15 && sourcing_name != NULL) || p_verbose >= 16) { msg_verbose_cmd(sourcing_lnum, cmdline_copy); } @@ -1281,10 +1281,6 @@ static char_u * do_one_cmd(char_u **cmdlinep, goto doend; } - if (p_verbose >= 16) { - msg_verbose_cmd(0, *cmdlinep); - } - // 1. Skip comment lines and leading white space and colons. // 2. Handle command modifiers. diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 27db957149..871143699a 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -722,6 +722,7 @@ func Test_verbosefile() endfunc func Test_verbose_option() + " See test/functional/ui/cmdline_spec.lua CheckScreendump let lines =<< trim [SCRIPT] diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 21c01b3458..01f0d8a4d7 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local source = helpers.source local command = helpers.command +local feed_command = helpers.feed_command local function new_screen(opt) local screen = Screen.new(25, 5) @@ -842,3 +843,34 @@ describe('cmdline redraw', function() ]], unchanged=true} end) end) + +describe('cmdline', function() + before_each(function() + clear() + end) + + it('prints every executed Ex command if verbose >= 16', function() + local screen = Screen.new(50, 12) + screen:attach() + source([[ + command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v + call feedkeys("\r", 't') " for the hit-enter prompt + set verbose=20 + ]]) + feed_command('DoSomething') + screen:expect([[ + | + ~ | + | + Executing: DoSomething | + Executing: echo 'hello' |set ts=4 |let v = '123' || + echo v | + hello | + Executing: set ts=4 |let v = '123' |echo v | + Executing: let v = '123' |echo v | + Executing: echo v | + 123 | + Press ENTER or type command to continue^ | + ]]) + end) +end) |