Merge pull request #13775 from janlazo/vim-8.2.2353

vim-patch:8.2.{2353,2355,2360,2361,2366,2368}
This commit is contained in:
Jan Edmund Lazo
2021-01-17 15:01:22 -05:00
committed by GitHub
12 changed files with 115 additions and 50 deletions

View File

@@ -61,7 +61,7 @@ jobs:
brew unlink gcc@8 gcc@9
brew update >/dev/null
brew upgrade
brew install automake ccache cpanminus ninja
brew install automake ccache perl cpanminus ninja
- name: Setup interpreter packages
run: |

View File

@@ -1543,6 +1543,8 @@ tag command action ~
|:sign| :sig[n] manipulate signs
|:silent| :sil[ent] run a command silently
|:sleep| :sl[eep] do nothing for a few seconds
|:sleep!| :sl[eep]! do nothing for a few seconds, without the
cursor visible
|:slast| :sla[st] split window and go to last file in the
argument list
|:smagic| :sm[agic] :substitute with 'magic'

View File

@@ -489,12 +489,12 @@ gO Show a filetype-specific, navigable "outline" of the
Currently works in |help| and |:Man| buffers.
[N]gs *gs* *:sl* *:sleep*
:[N]sl[eep] [N] [m] Do nothing for [N] seconds, or [N] milliseconds if [m]
:[N]sl[eep] [N][m] Do nothing for [N] seconds, or [N] milliseconds if [m]
was given. "gs" always uses seconds.
Default is one second. >
:sleep "sleep for one second
:5sleep "sleep for five seconds
:sleep 100m "sleep for a hundred milliseconds
:sleep 100m "sleep for 100 milliseconds
10gs "sleep for ten seconds
< Can be interrupted with CTRL-C.
"gs" stands for "goto sleep".

View File

@@ -1620,6 +1620,9 @@ au BufNewFile,BufRead *.mib,*.my setf mib
au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog
au BufNewFile,BufRead *.rules call dist#ft#FTRules()
" SPARQL queries
au BufNewFile,BufRead *.rq,*.sparql setf sparql
" Spec (Linux RPM)
au BufNewFile,BufRead *.spec setf spec

View File

@@ -3693,6 +3693,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
} else {
char_u *orig_line = NULL;
int len_change = 0;
const bool save_p_lz = p_lz;
int save_p_fen = curwin->w_p_fen;
curwin->w_p_fen = FALSE;
@@ -3701,6 +3702,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
int temp = RedrawingDisabled;
RedrawingDisabled = 0;
// avoid calling update_screen() in vgetorpeek()
p_lz = false;
if (new_start != NULL) {
/* There already was a substitution, we would
* like to show this to the user. We cannot
@@ -3754,7 +3758,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
/* clear the question */
msg_didout = FALSE; /* don't scroll up */
msg_col = 0;
gotocmdline(TRUE);
gotocmdline(true);
p_lz = save_p_lz;
// restore the line
if (orig_line != NULL) {

View File

@@ -2455,7 +2455,7 @@ module.cmds = {
},
{
command='sleep',
flags=bit.bor(RANGE, COUNT, EXTRA, TRLBAR, CMDWIN),
flags=bit.bor(BANG, RANGE, COUNT, EXTRA, TRLBAR, CMDWIN),
addr_type='ADDR_OTHER',
func='ex_sleep',
},

View File

@@ -3828,7 +3828,7 @@ static void cmd_cursor_goto(int row, int col)
ui_grid_cursor_goto(grid->handle, row, col);
}
void gotocmdline(int clr)
void gotocmdline(bool clr)
{
if (ui_has(kUICmdline)) {
return;

View File

@@ -4497,9 +4497,9 @@ find_pattern_in_path(
regmatch_T regmatch;
regmatch_T incl_regmatch;
regmatch_T def_regmatch;
int matched = FALSE;
int did_show = FALSE;
int found = FALSE;
bool matched = false;
bool did_show = false;
bool found = false;
int i;
char_u *already = NULL;
char_u *startp = NULL;
@@ -4611,7 +4611,7 @@ find_pattern_in_path(
}
MSG_PUTS_TITLE(_("in path ---\n"));
}
did_show = TRUE;
did_show = true;
while (depth_displayed < depth && !got_int) {
++depth_displayed;
for (i = 0; i < depth_displayed; i++)
@@ -4761,10 +4761,10 @@ search_line:
matched = !STRNCMP(startp, ptr, len);
if (matched && define_matched && whole
&& vim_iswordc(startp[len]))
matched = FALSE;
matched = false;
} else if (regmatch.regprog != NULL
&& vim_regexec(&regmatch, line, (colnr_T)(p - line))) {
matched = TRUE;
matched = true;
startp = regmatch.startp[0];
// Check if the line is not a comment line (unless we are
// looking for a define). A line starting with "# define"
@@ -4789,15 +4789,16 @@ search_line:
if (matched
&& p[0] == '/'
&& (p[1] == '*' || p[1] == '/')) {
matched = FALSE;
/* After "//" all text is comment */
if (p[1] == '/')
matched = false;
// After "//" all text is comment
if (p[1] == '/') {
break;
++p;
}
p++;
} else if (!matched && p[0] == '*' && p[1] == '/') {
/* Can find match after "* /". */
matched = TRUE;
++p;
// Can find match after "* /".
matched = true;
p++;
}
}
}
@@ -4811,7 +4812,7 @@ search_line:
if (depth == -1 && lnum == curwin->w_cursor.lnum)
break;
found = TRUE;
found = true;
aux = p = startp;
if (compl_cont_status & CONT_ADDING) {
p += compl_length;
@@ -4879,9 +4880,10 @@ search_line:
break;
}
} else if (action == ACTION_SHOW_ALL) {
found = TRUE;
if (!did_show)
gotocmdline(TRUE); /* cursor at status line */
found = true;
if (!did_show) {
gotocmdline(true); // cursor at status line
}
if (curr_fname != prev_fname) {
if (did_show)
msg_putchar('\n'); /* cursor below last one */
@@ -4890,28 +4892,28 @@ search_line:
msg_home_replace_hl(curr_fname);
prev_fname = curr_fname;
}
did_show = TRUE;
if (!got_int)
show_pat_in_path(line, type, TRUE, action,
(depth == -1) ? NULL : files[depth].fp,
(depth == -1) ? &lnum : &files[depth].lnum,
match_count++);
did_show = true;
if (!got_int) {
show_pat_in_path(line, type, true, action,
(depth == -1) ? NULL : files[depth].fp,
(depth == -1) ? &lnum : &files[depth].lnum,
match_count++);
}
/* Set matched flag for this file and all the ones that
* include it */
for (i = 0; i <= depth; ++i)
files[i].matched = TRUE;
} else if (--count <= 0) {
found = TRUE;
found = true;
if (depth == -1 && lnum == curwin->w_cursor.lnum
&& l_g_do_tagpreview == 0
)
&& l_g_do_tagpreview == 0) {
EMSG(_("E387: Match is on current line"));
else if (action == ACTION_SHOW) {
} else if (action == ACTION_SHOW) {
show_pat_in_path(line, type, did_show, action,
(depth == -1) ? NULL : files[depth].fp,
(depth == -1) ? &lnum : &files[depth].lnum, 1L);
did_show = TRUE;
(depth == -1) ? NULL : files[depth].fp,
(depth == -1) ? &lnum : &files[depth].lnum, 1L);
did_show = true;
} else {
/* ":psearch" uses the preview window */
if (l_g_do_tagpreview != 0) {
@@ -4960,15 +4962,16 @@ search_line:
break;
}
exit_matched:
matched = FALSE;
/* look for other matches in the rest of the line if we
* are not at the end of it already */
matched = false;
// look for other matches in the rest of the line if we
// are not at the end of it already
if (def_regmatch.regprog == NULL
&& action == ACTION_EXPAND
&& !(compl_cont_status & CONT_SOL)
&& *startp != NUL
&& *(p = startp + utfc_ptr2len(startp)) != NUL)
&& *(p = startp + utfc_ptr2len(startp)) != NUL) {
goto search_line;
}
}
line_breakcheck();
if (action == ACTION_EXPAND)
@@ -5046,16 +5049,20 @@ fpip_end:
vim_regfree(def_regmatch.regprog);
}
static void show_pat_in_path(char_u *line, int type, int did_show, int action, FILE *fp, linenr_T *lnum, long count)
static void show_pat_in_path(char_u *line, int type, bool did_show, int action,
FILE *fp, linenr_T *lnum, long count)
FUNC_ATTR_NONNULL_ARG(1, 6)
{
char_u *p;
if (did_show)
msg_putchar('\n'); /* cursor below last one */
else if (!msg_silent)
gotocmdline(TRUE); /* cursor at status line */
if (got_int) /* 'q' typed at "--more--" message */
if (did_show) {
msg_putchar('\n'); // cursor below last one
} else if (!msg_silent) {
gotocmdline(true); // cursor at status line
}
if (got_int) { // 'q' typed at "--more--" message
return;
}
for (;; ) {
p = line + STRLEN(line) - 1;
if (fp != NULL) {

View File

@@ -1110,14 +1110,14 @@ func Test_BufReadCmd()
endfunc
func SetChangeMarks(start, end)
exe a:start. 'mark ['
exe a:end. 'mark ]'
exe a:start .. 'mark ['
exe a:end .. 'mark ]'
endfunc
" Verify the effects of autocmds on '[ and ']
func Test_change_mark_in_autocmds()
edit! Xtest
call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u", 'xtn')
call feedkeys("ia\<CR>b\<CR>c\<CR>d\<C-g>u\<Esc>", 'xtn')
call SetChangeMarks(2, 3)
write

View File

@@ -429,6 +429,7 @@ let s:filename_checks = {
\ 'smith': ['file.smt', 'file.smith'],
\ 'sml': ['file.sml'],
\ 'snobol4': ['file.sno', 'file.spt'],
\ 'sparql': ['file.rq', 'file.sparql'],
\ 'spec': ['file.spec'],
\ 'spice': ['file.sp', 'file.spice'],
\ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
@@ -715,7 +716,7 @@ func Test_pp_file()
call assert_equal('pascal', &filetype)
bwipe!
call delete('Xfile.ts')
call delete('Xfile.pp')
filetype off
endfunc

View File

@@ -266,8 +266,14 @@ func Test_set_errors()
call assert_fails('set foldmarker=x', 'E536:')
call assert_fails('set commentstring=x', 'E537:')
call assert_fails('set complete=x', 'E539:')
call assert_fails('set rulerformat=%-', 'E539:')
call assert_fails('set rulerformat=%(', 'E542:')
call assert_fails('set rulerformat=%15(%%', 'E542:')
call assert_fails('set statusline=%$', 'E539:')
call assert_fails('set statusline=%{', 'E540:')
call assert_fails('set statusline=%(', 'E542:')
call assert_fails('set statusline=%)', 'E542:')
if has('cursorshape')
" This invalid value for 'guicursor' used to cause Vim to crash.
call assert_fails('set guicursor=i-ci,r-cr:h', 'E545:')
@@ -281,6 +287,21 @@ func Test_set_errors()
call assert_fails('set winminwidth=10 winwidth=9', 'E592:')
call assert_fails("set showbreak=\x01", 'E595:')
call assert_fails('set t_foo=', 'E846:')
if has('python') || has('python3')
call assert_fails('set pyxversion=6', 'E474:')
endif
call assert_fails("let &tabstop='ab'", 'E521:')
call assert_fails('set sessionoptions=curdir,sesdir', 'E474:')
call assert_fails('set foldmarker={{{,', 'E474:')
call assert_fails('set sessionoptions=sesdir,curdir', 'E474:')
call assert_fails('set listchars=trail:· ambiwidth=double', 'E834:')
set listchars&
call assert_fails('set fillchars=stl:· ambiwidth=double', 'E835:')
set fillchars&
call assert_fails('set fileencoding=latin1,utf-8', 'E474:')
set nomodifiable
call assert_fails('set fileencoding=latin1', 'E21:')
set modifiable&
endfunc
" Must be executed before other tests that set 'term'.

View File

@@ -0,0 +1,26 @@
" Test for sleep and sleep! commands
func! s:get_time_ms()
let timestr = reltimestr(reltime())
let dotidx = stridx(timestr, '.')
let sec = str2nr(timestr[:dotidx])
let msec = str2nr(timestr[dotidx + 1:])
return (sec * 1000) + (msec / 1000)
endfunc
func! s:assert_takes_longer(cmd, time_ms)
let start = s:get_time_ms()
execute a:cmd
let end = s:get_time_ms()
call assert_true(end - start >=# a:time_ms)
endfun
func! Test_sleep_bang()
call s:assert_takes_longer('sleep 50m', 50)
call s:assert_takes_longer('sleep! 50m', 50)
call s:assert_takes_longer('sl 50m', 50)
call s:assert_takes_longer('sl! 50m', 50)
call s:assert_takes_longer('1sleep', 1000)
endfunc
" vim: shiftwidth=2 sts=2 expandtab