0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.2143: cannot see each command even when 'verbose' is set

Problem:    Cannot see each command even when 'verbose' is set.
Solution:   List each command when 'verbose' is at least 16.
This commit is contained in:
Bram Moolenaar
2019-10-12 20:17:40 +02:00
parent d1e2f3984a
commit 4facea310c
5 changed files with 68 additions and 17 deletions

View File

@@ -558,6 +558,27 @@ do_exmode(
msg_scroll = save_msg_scroll; 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)
{
++no_wait_return;
verbose_enter_scroll();
if (lnum == 0)
smsg(_("Executing: %s"), cmd);
else
smsg(_("line %ld: %s"), (long)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 "*". * Execute a simple command line. Used for translated commands like "*".
*/ */
@@ -944,18 +965,7 @@ do_cmdline(
} }
if (p_verbose >= 15 && sourcing_name != NULL) if (p_verbose >= 15 && sourcing_name != NULL)
{ msg_verbose_cmd(sourcing_lnum, cmdline_copy);
++no_wait_return;
verbose_enter_scroll();
smsg(_("line %ld: %s"),
(long)sourcing_lnum, cmdline_copy);
if (msg_silent == 0)
msg_puts("\n"); /* don't overwrite this */
verbose_leave_scroll();
--no_wait_return;
}
/* /*
* 2. Execute one '|' separated command. * 2. Execute one '|' separated command.
@@ -1666,6 +1676,9 @@ do_one_cmd(
if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!') if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!')
goto doend; goto doend;
if (p_verbose >= 16)
msg_verbose_cmd(0, *cmdlinep);
/* /*
* 1. Skip comment lines and leading white space and colons. * 1. Skip comment lines and leading white space and colons.
* 2. Handle command modifiers. * 2. Handle command modifiers.
@@ -8534,9 +8547,9 @@ ex_folddo(exarg_T *eap)
{ {
linenr_T lnum; linenr_T lnum;
#ifdef FEAT_CLIPBOARD # ifdef FEAT_CLIPBOARD
start_global_changes(); start_global_changes();
#endif # endif
/* First set the marks for all lines closed/open. */ /* First set the marks for all lines closed/open. */
for (lnum = eap->line1; lnum <= eap->line2; ++lnum) for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
@@ -8546,9 +8559,9 @@ ex_folddo(exarg_T *eap)
/* Execute the command on the marked lines. */ /* Execute the command on the marked lines. */
global_exe(eap->arg); global_exe(eap->arg);
ml_clearmarked(); /* clear rest of the marks */ ml_clearmarked(); /* clear rest of the marks */
#ifdef FEAT_CLIPBOARD # ifdef FEAT_CLIPBOARD
end_global_changes(); end_global_changes();
#endif # endif
} }
#endif #endif
@@ -8566,7 +8579,7 @@ is_loclist_cmd(int cmdidx)
} }
#endif #endif
# if defined(FEAT_TIMERS) || defined(PROTO) #if defined(FEAT_TIMERS) || defined(PROTO)
int int
get_pressedreturn(void) get_pressedreturn(void)
{ {

View File

@@ -0,0 +1,12 @@
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|~| @73
|E+0#0000000&|x|e|c|u|t|i|n|g|:| |D|o|S|o|m|e|t|h|i|n|g| @52
|E|x|e|c|u|t|i|n|g|:| |e|c|h|o| |'|h|e|l@1|o|'| |||s|e|t| |t|s|=|4| |||l|e|t| |v| |=| |'|1|2|3|'| |||e|c|h|o| |v| @18
|h|e|l@1|o| @69
|E|x|e|c|u|t|i|n|g|:| |s|e|t| |t|s|=|4| |||l|e|t| |v| |=| |'|1|2|3|'| |||e|c|h|o| |v| @32
|E|x|e|c|u|t|i|n|g|:| |l|e|t| |v| |=| |'|1|2|3|'| |||e|c|h|o| |v| @42
|E|x|e|c|u|t|i|n|g|:| |e|c|h|o| |v| @57
|1|2|3| @71
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35

View File

@@ -1,5 +1,8 @@
" Tests for editing the command line. " Tests for editing the command line.
source check.vim
source screendump.vim
func Test_complete_tab() func Test_complete_tab()
call writefile(['testfile'], 'Xtestfile') call writefile(['testfile'], 'Xtestfile')
call feedkeys(":e Xtest\t\r", "tx") call feedkeys(":e Xtest\t\r", "tx")
@@ -687,6 +690,26 @@ func Test_verbosefile()
call delete('Xlog') call delete('Xlog')
endfunc 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 Test_setcmdpos()
func InsertTextAtPos(text, pos) func InsertTextAtPos(text, pos)
call assert_equal(0, setcmdpos(a:pos)) call assert_equal(0, setcmdpos(a:pos))

View File

@@ -501,6 +501,7 @@ func Test_tselect()
call term_sendkeys(buf, ":tselect main\<CR>2\<CR>") call term_sendkeys(buf, ":tselect main\<CR>2\<CR>")
call VerifyScreenDump(buf, 'Test_tselect_1', {}) call VerifyScreenDump(buf, 'Test_tselect_1', {})
call StopVimInTerminal(buf)
call delete('Xtags') call delete('Xtags')
call delete('Xtest.c') call delete('Xtest.c')
call delete('XTest_tselect') call delete('XTest_tselect')

View File

@@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2143,
/**/ /**/
2142, 2142,
/**/ /**/