mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 19:35:37 +00:00
Merge pull request #13865 from janlazo/vim-8.2.2437
vim-patch:8.2.{2437,2439,2442,2446,2447,2448,2457,2458,2462,2464}
This commit is contained in:
@@ -790,7 +790,10 @@ void ex_retab(exarg_T *eap)
|
|||||||
for (col = 0; col < len; col++) {
|
for (col = 0; col < len; col++) {
|
||||||
ptr[col] = (col < num_tabs) ? '\t' : ' ';
|
ptr[col] = (col < num_tabs) ? '\t' : ' ';
|
||||||
}
|
}
|
||||||
ml_replace(lnum, new_line, false);
|
if (ml_replace(lnum, new_line, false) == OK) {
|
||||||
|
// "new_line" may have been copied
|
||||||
|
new_line = curbuf->b_ml.ml_line_ptr;
|
||||||
|
}
|
||||||
if (first_line == 0) {
|
if (first_line == 0) {
|
||||||
first_line = lnum;
|
first_line = lnum;
|
||||||
}
|
}
|
||||||
@@ -2413,7 +2416,10 @@ int do_ecmd(
|
|||||||
(flags & ECMD_HIDE) || curbuf->terminal ? 0 : DOBUF_UNLOAD,
|
(flags & ECMD_HIDE) || curbuf->terminal ? 0 : DOBUF_UNLOAD,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
the_curwin->w_closing = false;
|
// Autocommands may have closed the window.
|
||||||
|
if (win_valid(the_curwin)) {
|
||||||
|
the_curwin->w_closing = false;
|
||||||
|
}
|
||||||
buf->b_locked--;
|
buf->b_locked--;
|
||||||
|
|
||||||
// autocmds may abort script processing
|
// autocmds may abort script processing
|
||||||
|
|||||||
@@ -2999,7 +2999,6 @@ static void foldlevelDiff(fline_T *flp)
|
|||||||
static void foldlevelExpr(fline_T *flp)
|
static void foldlevelExpr(fline_T *flp)
|
||||||
{
|
{
|
||||||
win_T *win;
|
win_T *win;
|
||||||
int n;
|
|
||||||
int c;
|
int c;
|
||||||
linenr_T lnum = flp->lnum + flp->off;
|
linenr_T lnum = flp->lnum + flp->off;
|
||||||
|
|
||||||
@@ -3017,7 +3016,7 @@ static void foldlevelExpr(fline_T *flp)
|
|||||||
/* KeyTyped may be reset to 0 when calling a function which invokes
|
/* KeyTyped may be reset to 0 when calling a function which invokes
|
||||||
* do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */
|
* do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */
|
||||||
const bool save_keytyped = KeyTyped;
|
const bool save_keytyped = KeyTyped;
|
||||||
n = (int)eval_foldexpr(flp->wp->w_p_fde, &c);
|
const int n = eval_foldexpr(flp->wp->w_p_fde, &c);
|
||||||
KeyTyped = save_keytyped;
|
KeyTyped = save_keytyped;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -3202,8 +3201,10 @@ int put_folds(FILE *fd, win_T *wp)
|
|||||||
{
|
{
|
||||||
if (foldmethodIsManual(wp)) {
|
if (foldmethodIsManual(wp)) {
|
||||||
if (put_line(fd, "silent! normal! zE") == FAIL
|
if (put_line(fd, "silent! normal! zE") == FAIL
|
||||||
|| put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL)
|
|| put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL
|
||||||
|
|| put_line(fd, "let &fdl = &fdl") == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If some folds are manually opened/closed, need to restore that. */
|
/* If some folds are manually opened/closed, need to restore that. */
|
||||||
|
|||||||
@@ -5387,7 +5387,8 @@ spell_add_word (
|
|||||||
len, word, NameBuff);
|
len, word, NameBuff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fseek(fd, fpos_next, SEEK_SET) <= 0) {
|
if (fseek(fd, fpos_next, SEEK_SET) != 0) {
|
||||||
|
PERROR(_("Seek error in spellfile"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1939,4 +1939,15 @@ func Test_autocmd_window()
|
|||||||
%bw!
|
%bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_autocmd_closes_window()
|
||||||
|
au BufNew,BufWinLeave * e %e
|
||||||
|
file yyy
|
||||||
|
au BufNew,BufWinLeave * ball
|
||||||
|
call assert_fails('n xxx', 'E143:')
|
||||||
|
|
||||||
|
bwipe %
|
||||||
|
au! BufNew
|
||||||
|
au! BufWinLeave
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -291,6 +291,32 @@ endfunc
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
func Test_mkview_open_folds()
|
||||||
|
enew!
|
||||||
|
|
||||||
|
call append(0, ['a', 'b', 'c'])
|
||||||
|
1,3fold
|
||||||
|
" zR affects 'foldlevel', make sure the option is applied after the folds
|
||||||
|
" have been recreated.
|
||||||
|
normal zR
|
||||||
|
write! Xtestfile
|
||||||
|
|
||||||
|
call assert_equal(-1, foldclosed(1))
|
||||||
|
call assert_equal(-1, foldclosed(2))
|
||||||
|
call assert_equal(-1, foldclosed(3))
|
||||||
|
|
||||||
|
mkview! Xtestview
|
||||||
|
source Xtestview
|
||||||
|
|
||||||
|
call assert_equal(-1, foldclosed(1))
|
||||||
|
call assert_equal(-1, foldclosed(2))
|
||||||
|
call assert_equal(-1, foldclosed(3))
|
||||||
|
|
||||||
|
call delete('Xtestview')
|
||||||
|
call delete('Xtestfile')
|
||||||
|
%bwipe
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test :mkview with a file argument.
|
" Test :mkview with a file argument.
|
||||||
func Test_mkview_file()
|
func Test_mkview_file()
|
||||||
" Create a view with line number and a fold.
|
" Create a view with line number and a fold.
|
||||||
|
|||||||
@@ -330,12 +330,10 @@ func Test_set_ttytype()
|
|||||||
set ttytype=xterm
|
set ttytype=xterm
|
||||||
call assert_equal('xterm', &ttytype)
|
call assert_equal('xterm', &ttytype)
|
||||||
call assert_equal(&ttytype, &term)
|
call assert_equal(&ttytype, &term)
|
||||||
" "set ttytype=" gives E522 instead of E529
|
|
||||||
" in travis on some builds. Why? Catch both for now
|
|
||||||
try
|
try
|
||||||
set ttytype=
|
set ttytype=
|
||||||
call assert_report('set ttytype= did not fail')
|
call assert_report('set ttytype= did not fail')
|
||||||
catch /E529\|E522/
|
catch /E529/
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
" Some systems accept any terminal name and return dumb settings,
|
" Some systems accept any terminal name and return dumb settings,
|
||||||
|
|||||||
Reference in New Issue
Block a user