aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c36
-rw-r--r--src/nvim/testdir/test_cmdline.vim23
-rw-r--r--src/nvim/testdir/test_tagjump.vim34
3 files changed, 83 insertions, 10 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 7bb4bd32a3..a4ed86e4c0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -258,6 +258,27 @@ void do_exmode(int improved)
msg_scroll = save_msg_scroll;
}
+// Print the executed command for when 'verbose' is set.
+// When "lnum" is 0 only print the command.
+static void msg_verbose_cmd(linenr_T lnum, char_u *cmd)
+ FUNC_ATTR_NONNULL_ALL
+{
+ no_wait_return++;
+ verbose_enter_scroll();
+
+ if (lnum == 0) {
+ smsg(_("Executing: %s"), cmd);
+ } else {
+ smsg(_("line %" PRIdLINENR ": %s"), lnum, cmd);
+ }
+ if (msg_silent == 0) {
+ msg_puts("\n"); // don't overwrite this
+ }
+
+ verbose_leave_scroll();
+ no_wait_return--;
+}
+
/*
* Execute a simple command line. Used for translated commands like "*".
*/
@@ -568,16 +589,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
}
if (p_verbose >= 15 && sourcing_name != NULL) {
- ++no_wait_return;
- verbose_enter_scroll();
-
- smsg(_("line %" PRIdLINENR ": %s"), sourcing_lnum, cmdline_copy);
- if (msg_silent == 0) {
- msg_puts("\n"); // don't overwrite this either
- }
-
- verbose_leave_scroll();
- --no_wait_return;
+ msg_verbose_cmd(sourcing_lnum, cmdline_copy);
}
/*
@@ -1269,6 +1281,10 @@ 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 f8d84f1a49..27db957149 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -1,5 +1,8 @@
" Tests for editing the command line.
+source check.vim
+source screendump.vim
+
func Test_complete_tab()
call writefile(['testfile'], 'Xtestfile')
call feedkeys(":e Xtestf\t\r", "tx")
@@ -718,6 +721,26 @@ func Test_verbosefile()
call delete('Xlog')
endfunc
+func Test_verbose_option()
+ CheckScreendump
+
+ let lines =<< trim [SCRIPT]
+ command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
+ call feedkeys("\r", 't') " for the hit-enter prompt
+ set verbose=20
+ [SCRIPT]
+ call writefile(lines, 'XTest_verbose')
+
+ let buf = RunVimInTerminal('-S XTest_verbose', {'rows': 12})
+ call term_wait(buf, 100)
+ call term_sendkeys(buf, ":DoSomething\<CR>")
+ call VerifyScreenDump(buf, 'Test_verbose_option_1', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XTest_verbose')
+endfunc
+
func Test_setcmdpos()
func InsertTextAtPos(text, pos)
call assert_equal(0, setcmdpos(a:pos))
diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim
index 6abe5b7c89..7057cdefb2 100644
--- a/src/nvim/testdir/test_tagjump.vim
+++ b/src/nvim/testdir/test_tagjump.vim
@@ -1,5 +1,8 @@
" Tests for tagjump (tags and special searches)
+source check.vim
+source screendump.vim
+
" SEGV occurs in older versions. (At least 7.4.1748 or older)
func Test_ptag_with_notagstack()
set notagstack
@@ -551,6 +554,37 @@ func Test_tag_line_toolong()
let &verbose = old_vbs
endfunc
+" Check that using :tselect does not run into the hit-enter prompt.
+" Requires a terminal to trigger that prompt.
+func Test_tselect()
+ CheckScreendump
+
+ call writefile([
+ \ 'main Xtest.h /^void test();$/;" f',
+ \ 'main Xtest.c /^int main()$/;" f',
+ \ 'main Xtest.x /^void test()$/;" f',
+ \ ], 'Xtags')
+ cal writefile([
+ \ 'int main()',
+ \ 'void test()',
+ \ ], 'Xtest.c')
+
+ let lines =<< trim [SCRIPT]
+ set tags=Xtags
+ [SCRIPT]
+ call writefile(lines, 'XTest_tselect')
+ let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})
+
+ call term_wait(buf, 100)
+ call term_sendkeys(buf, ":tselect main\<CR>2\<CR>")
+ call VerifyScreenDump(buf, 'Test_tselect_1', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xtags')
+ call delete('Xtest.c')
+ call delete('XTest_tselect')
+endfunc
+
func Test_tagline()
call writefile([
\ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',