Merge pull request #13026 from janlazo/vim-8.2.1779

vim-patch:8.1.{2143},8.2.{841,1779,1780,1784,1787}
This commit is contained in:
Jan Edmund Lazo
2020-10-03 02:12:54 -04:00
committed by GitHub
11 changed files with 177 additions and 23 deletions

View File

@@ -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.

View File

@@ -313,7 +313,7 @@ au BufNewFile,BufRead *.css setf css
au BufNewFile,BufRead *.con setf cterm
" Changelog
au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch
au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch,*/debian/changelog
\ setf debchangelog
au BufNewFile,BufRead [cC]hange[lL]og

View File

@@ -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 "*".
*/
@@ -567,17 +588,8 @@ 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;
if ((p_verbose >= 15 && sourcing_name != NULL) || p_verbose >= 16) {
msg_verbose_cmd(sourcing_lnum, cmdline_copy);
}
/*

View File

@@ -651,6 +651,10 @@ int searchit(
colnr_T col = at_first_line && (options & SEARCH_COL) ? pos->col : 0;
nmatched = vim_regexec_multi(&regmatch, win, buf,
lnum, col, tm, timed_out);
// vim_regexec_multi() may clear "regprog"
if (regmatch.regprog == NULL) {
break;
}
// Abort searching on an error (e.g., out of stack).
if (called_emsg || (timed_out != NULL && *timed_out)) {
break;
@@ -722,6 +726,10 @@ int searchit(
match_ok = false;
break;
}
// vim_regexec_multi() may clear "regprog"
if (regmatch.regprog == NULL) {
break;
}
matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
submatch = first_submatch(&regmatch);
@@ -811,10 +819,13 @@ int searchit(
}
break;
}
/* Need to get the line pointer again, a
* multi-line search may have made it invalid. */
ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
// vim_regexec_multi() may clear "regprog"
if (regmatch.regprog == NULL) {
break;
}
// Need to get the line pointer again, a
// multi-line search may have made it invalid.
ptr = ml_get_buf(buf, lnum + matchpos.lnum, false);
}
/*
@@ -891,6 +902,11 @@ int searchit(
}
at_first_line = FALSE;
// vim_regexec_multi() may clear "regprog"
if (regmatch.regprog == NULL) {
break;
}
// Stop the search if wrapscan isn't set, "stop_lnum" is
// specified, after an interrupt, after a match and after looping
// twice.
@@ -4243,7 +4259,8 @@ is_zero_width(char_u *pattern, int move, pos_T *cur, Direction direction)
if (nmatched != 0) {
break;
}
} while (direction == FORWARD
} while (regmatch.regprog != NULL
&& direction == FORWARD
? regmatch.startpos[0].col < pos.col
: regmatch.startpos[0].col > pos.col);

View File

@@ -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,27 @@ func Test_verbosefile()
call delete('Xlog')
endfunc
func Test_verbose_option()
" See test/functional/ui/cmdline_spec.lua
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))

View File

@@ -128,6 +128,7 @@ let s:filename_checks = {
\ 'dart': ['file.dart', 'file.drt'],
\ 'datascript': ['file.ds'],
\ 'dcd': ['file.dcd'],
\ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'],
\ 'debcontrol': ['/debian/control'],
\ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list'],
\ 'def': ['file.def'],

View File

@@ -981,6 +981,21 @@ func Test_incsearch_substitute()
call Incsearch_cleanup()
endfunc
func Test_incsearch_substitute_long_line()
throw 'skipped: Nvim does not support test_override()'
new
call test_override("char_avail", 1)
set incsearch
call repeat('x', 100000)->setline(1)
call feedkeys(':s/\%c', 'xt')
redraw
call feedkeys("\<Esc>", 'xt')
call Incsearch_cleanup()
bwipe!
endfunc
func Test_search_undefined_behaviour()
if !has("terminal")
return

View File

@@ -412,3 +412,22 @@ func Test_statusline_removed_group()
call StopVimInTerminal(buf)
call delete('XTest_statusline')
endfunc
func Test_statusline_after_split_vsplit()
only
" Make the status line of each window show the window number.
set ls=2 stl=%{winnr()}
split | redraw
vsplit | redraw
" The status line of the third window should read '3' here.
call assert_equal('3', nr2char(screenchar(&lines - 1, 1)))
only
set ls& stl&
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -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',

View File

@@ -1490,13 +1490,11 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
if (flags & (WSP_TOP | WSP_BOT))
(void)win_comp_pos();
/*
* Both windows need redrawing
*/
// Both windows need redrawing. Update all status lines, in case they
// show something related to the window count or position.
redraw_win_later(wp, NOT_VALID);
wp->w_redr_status = TRUE;
redraw_win_later(oldwin, NOT_VALID);
oldwin->w_redr_status = TRUE;
status_redraw_all();
if (need_status) {
msg_row = Rows - 1;

View File

@@ -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)