mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #26022 from zeertzjq/vim-8.0.1592
vim-patch:partial:8.0.1592,8.1.{0870,partial:1218,1581,2276,2373},8.2.{2112,4850}
This commit is contained in:
commit
e3e5fadee0
@ -324,9 +324,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
// when 'viewoptions' contains "cursor".
|
// when 'viewoptions' contains "cursor".
|
||||||
do_cursor = (flagp == &ssop_flags || *flagp & SSOP_CURSOR);
|
do_cursor = (flagp == &ssop_flags || *flagp & SSOP_CURSOR);
|
||||||
|
|
||||||
//
|
|
||||||
// Local argument list.
|
// Local argument list.
|
||||||
//
|
|
||||||
if (wp->w_alist == &global_alist) {
|
if (wp->w_alist == &global_alist) {
|
||||||
PUTLINE_FAIL("argglobal");
|
PUTLINE_FAIL("argglobal");
|
||||||
} else {
|
} else {
|
||||||
@ -419,21 +417,17 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Local mappings and abbreviations.
|
// Local mappings and abbreviations.
|
||||||
//
|
|
||||||
if ((*flagp & (SSOP_OPTIONS | SSOP_LOCALOPTIONS))
|
if ((*flagp & (SSOP_OPTIONS | SSOP_LOCALOPTIONS))
|
||||||
&& makemap(fd, wp->w_buffer) == FAIL) {
|
&& makemap(fd, wp->w_buffer) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Local options. Need to go to the window temporarily.
|
// Local options. Need to go to the window temporarily.
|
||||||
// Store only local values when using ":mkview" and when ":mksession" is
|
// Store only local values when using ":mkview" and when ":mksession" is
|
||||||
// used and 'sessionoptions' doesn't include "nvim/options".
|
// used and 'sessionoptions' doesn't include "nvim/options".
|
||||||
// Some folding options are always stored when "folds" is included,
|
// Some folding options are always stored when "folds" is included,
|
||||||
// otherwise the folds would not be restored correctly.
|
// otherwise the folds would not be restored correctly.
|
||||||
//
|
|
||||||
save_curwin = curwin;
|
save_curwin = curwin;
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
@ -451,9 +445,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Save Folds when 'buftype' is empty and for help files.
|
// Save Folds when 'buftype' is empty and for help files.
|
||||||
//
|
|
||||||
if ((*flagp & SSOP_FOLDS)
|
if ((*flagp & SSOP_FOLDS)
|
||||||
&& wp->w_buffer->b_ffname != NULL
|
&& wp->w_buffer->b_ffname != NULL
|
||||||
&& (bt_normal(wp->w_buffer)
|
&& (bt_normal(wp->w_buffer)
|
||||||
@ -463,9 +455,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Set the cursor after creating folds, since that moves the cursor.
|
// Set the cursor after creating folds, since that moves the cursor.
|
||||||
//
|
|
||||||
if (do_cursor) {
|
if (do_cursor) {
|
||||||
// Restore the cursor line in the file and relatively in the
|
// Restore the cursor line in the file and relatively in the
|
||||||
// window. Don't use "G", it changes the jumplist.
|
// window. Don't use "G", it changes the jumplist.
|
||||||
@ -516,10 +506,8 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Local directory, if the current flag is not view options or the "curdir"
|
// Local directory, if the current flag is not view options or the "curdir"
|
||||||
// option is included.
|
// option is included.
|
||||||
//
|
|
||||||
if (wp->w_localdir != NULL
|
if (wp->w_localdir != NULL
|
||||||
&& (flagp != &vop_flags || (*flagp & SSOP_CURDIR))) {
|
&& (flagp != &vop_flags || (*flagp & SSOP_CURDIR))) {
|
||||||
if (fputs("lcd ", fd) < 0
|
if (fputs("lcd ", fd) < 0
|
||||||
@ -549,7 +537,6 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
win_T *wp;
|
win_T *wp;
|
||||||
char *sname;
|
char *sname;
|
||||||
win_T *edited_win = NULL;
|
win_T *edited_win = NULL;
|
||||||
int tabnr;
|
|
||||||
win_T *tab_firstwin;
|
win_T *tab_firstwin;
|
||||||
frame_T *tab_topframe;
|
frame_T *tab_topframe;
|
||||||
int cur_arg_idx = 0;
|
int cur_arg_idx = 0;
|
||||||
@ -574,9 +561,7 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Now a :cd command to the session directory or the current directory
|
// Now a :cd command to the session directory or the current directory
|
||||||
//
|
|
||||||
if (ssop_flags & SSOP_SESDIR) {
|
if (ssop_flags & SSOP_SESDIR) {
|
||||||
PUTLINE_FAIL("exe \"cd \" . escape(expand(\"<sfile>:p:h\"), ' ')");
|
PUTLINE_FAIL("exe \"cd \" . escape(expand(\"<sfile>:p:h\"), ' ')");
|
||||||
} else if (ssop_flags & SSOP_CURDIR) {
|
} else if (ssop_flags & SSOP_CURDIR) {
|
||||||
@ -658,16 +643,10 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
restore_stal = true;
|
restore_stal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// For each tab:
|
|
||||||
// - Put windows for each tab, when "tabpages" is in 'sessionoptions'.
|
|
||||||
// - Don't use goto_tabpage(), it may change CWD and trigger autocommands.
|
|
||||||
//
|
|
||||||
tab_firstwin = firstwin; // First window in tab page "tabnr".
|
|
||||||
tab_topframe = topframe;
|
|
||||||
if ((ssop_flags & SSOP_TABPAGES)) {
|
if ((ssop_flags & SSOP_TABPAGES)) {
|
||||||
// Similar to ses_win_rec() below, populate the tab pages first so
|
// "tabpages" is in 'sessionoptions': Similar to ses_win_rec() below,
|
||||||
// later local options won't be copied to the new tabs.
|
// populate the tab pages first so later local options won't be copied
|
||||||
|
// to the new tabs.
|
||||||
FOR_ALL_TABS(tp) {
|
FOR_ALL_TABS(tp) {
|
||||||
// Use `bufhidden=wipe` to remove empty "placeholder" buffers once
|
// Use `bufhidden=wipe` to remove empty "placeholder" buffers once
|
||||||
// they are not needed. This prevents creating extra buffers (see
|
// they are not needed. This prevents creating extra buffers (see
|
||||||
@ -681,15 +660,17 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (tabnr = 1;; tabnr++) {
|
|
||||||
tabpage_T *tp = find_tabpage(tabnr);
|
|
||||||
if (tp == NULL) {
|
|
||||||
break; // done all tab pages
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Assume "tabpages" is in 'sessionoptions'. If not then we only do
|
||||||
|
// "curtab" and bail out of the loop.
|
||||||
|
FOR_ALL_TABS(tp) {
|
||||||
bool need_tabnext = false;
|
bool need_tabnext = false;
|
||||||
int cnr = 1;
|
int cnr = 1;
|
||||||
|
|
||||||
|
// May repeat putting Windows for each tab, when "tabpages" is in
|
||||||
|
// 'sessionoptions'.
|
||||||
|
// Don't use goto_tabpage(), it may change directory and trigger
|
||||||
|
// autocommands.
|
||||||
if ((ssop_flags & SSOP_TABPAGES)) {
|
if ((ssop_flags & SSOP_TABPAGES)) {
|
||||||
if (tp == curtab) {
|
if (tp == curtab) {
|
||||||
tab_firstwin = firstwin;
|
tab_firstwin = firstwin;
|
||||||
@ -698,16 +679,18 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
tab_firstwin = tp->tp_firstwin;
|
tab_firstwin = tp->tp_firstwin;
|
||||||
tab_topframe = tp->tp_topframe;
|
tab_topframe = tp->tp_topframe;
|
||||||
}
|
}
|
||||||
if (tabnr > 1) {
|
if (tp != first_tabpage) {
|
||||||
need_tabnext = true;
|
need_tabnext = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tp = curtab;
|
||||||
|
tab_firstwin = firstwin;
|
||||||
|
tab_topframe = topframe;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Before creating the window layout, try loading one file. If this
|
// Before creating the window layout, try loading one file. If this
|
||||||
// is aborted we don't end up with a number of useless windows.
|
// is aborted we don't end up with a number of useless windows.
|
||||||
// This may have side effects! (e.g., compressed or network file).
|
// This may have side effects! (e.g., compressed or network file).
|
||||||
//
|
|
||||||
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
||||||
if (ses_do_win(wp)
|
if (ses_do_win(wp)
|
||||||
&& wp->w_buffer->b_ffname != NULL
|
&& wp->w_buffer->b_ffname != NULL
|
||||||
@ -785,9 +768,19 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// Restore the tab-local working directory if specified
|
||||||
|
// Do this before the windows, so that the window-local directory can
|
||||||
|
// override the tab-local directory.
|
||||||
|
if ((ssop_flags & SSOP_CURDIR) && tp->tp_localdir != NULL) {
|
||||||
|
if (fputs("tcd ", fd) < 0
|
||||||
|
|| ses_put_fname(fd, tp->tp_localdir, &ssop_flags) == FAIL
|
||||||
|
|| put_eol(fd) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
did_lcd = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Restore the view of the window (options, file, cursor, etc.).
|
// Restore the view of the window (options, file, cursor, etc.).
|
||||||
//
|
|
||||||
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
||||||
if (!ses_do_win(wp)) {
|
if (!ses_do_win(wp)) {
|
||||||
continue;
|
continue;
|
||||||
@ -807,31 +800,17 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
// "tabedit".
|
// "tabedit".
|
||||||
cur_arg_idx = next_arg_idx;
|
cur_arg_idx = next_arg_idx;
|
||||||
|
|
||||||
//
|
|
||||||
// Restore cursor to the current window if it's not the first one.
|
// Restore cursor to the current window if it's not the first one.
|
||||||
//
|
|
||||||
if (cnr > 1 && (fprintf(fd, "%dwincmd w\n", cnr) < 0)) {
|
if (cnr > 1 && (fprintf(fd, "%dwincmd w\n", cnr) < 0)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Restore window sizes again after jumping around in windows, because
|
// Restore window sizes again after jumping around in windows, because
|
||||||
// the current window has a minimum size while others may not.
|
// the current window has a minimum size while others may not.
|
||||||
//
|
|
||||||
if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL) {
|
if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take care of tab-local working directories if applicable
|
|
||||||
if (tp->tp_localdir) {
|
|
||||||
if (fputs("if exists(':tcd') == 2 | tcd ", fd) < 0
|
|
||||||
|| ses_put_fname(fd, tp->tp_localdir, &ssop_flags) == FAIL
|
|
||||||
|| fputs(" | endif\n", fd) < 0) {
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
did_lcd = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't continue in another tab page when doing only the current one
|
// Don't continue in another tab page when doing only the current one
|
||||||
// or when at the last tab page.
|
// or when at the last tab page.
|
||||||
if (!(ssop_flags & SSOP_TABPAGES)) {
|
if (!(ssop_flags & SSOP_TABPAGES)) {
|
||||||
@ -848,9 +827,7 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Wipe out an empty unnamed buffer we started in.
|
// Wipe out an empty unnamed buffer we started in.
|
||||||
//
|
|
||||||
if (fprintf(fd, "%s",
|
if (fprintf(fd, "%s",
|
||||||
"if exists('s:wipebuf') "
|
"if exists('s:wipebuf') "
|
||||||
"&& len(win_findbuf(s:wipebuf)) == 0 "
|
"&& len(win_findbuf(s:wipebuf)) == 0 "
|
||||||
@ -882,9 +859,7 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
PUTLINE_FAIL("let &winminwidth = s:save_winminwidth");
|
PUTLINE_FAIL("let &winminwidth = s:save_winminwidth");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Lastly, execute the x.vim file if it exists.
|
// Lastly, execute the x.vim file if it exists.
|
||||||
//
|
|
||||||
if (fprintf(fd, "%s",
|
if (fprintf(fd, "%s",
|
||||||
"let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"\n"
|
"let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"\n"
|
||||||
"if filereadable(s:sx)\n"
|
"if filereadable(s:sx)\n"
|
||||||
@ -999,9 +974,8 @@ void ex_mkrc(exarg_T *eap)
|
|||||||
char *dirnow; // current directory
|
char *dirnow; // current directory
|
||||||
|
|
||||||
dirnow = xmalloc(MAXPATHL);
|
dirnow = xmalloc(MAXPATHL);
|
||||||
//
|
|
||||||
// Change to session file's dir.
|
// Change to session file's dir.
|
||||||
//
|
|
||||||
if (os_dirname(dirnow, MAXPATHL) == FAIL
|
if (os_dirname(dirnow, MAXPATHL) == FAIL
|
||||||
|| os_chdir(dirnow) != 0) {
|
|| os_chdir(dirnow) != 0) {
|
||||||
*dirnow = NUL;
|
*dirnow = NUL;
|
||||||
|
@ -2548,7 +2548,13 @@ func Test_Changed_FirstTime()
|
|||||||
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
|
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
|
||||||
call assert_equal('running', term_getstatus(buf))
|
call assert_equal('running', term_getstatus(buf))
|
||||||
" Wait for the ruler (in the status line) to be shown.
|
" Wait for the ruler (in the status line) to be shown.
|
||||||
call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))})
|
" In ConPTY, there is additional character which is drawn up to the width of
|
||||||
|
" the screen.
|
||||||
|
if has('conpty')
|
||||||
|
call WaitForAssert({-> assert_match('\<All.*$', term_getline(buf, 3))})
|
||||||
|
else
|
||||||
|
call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))})
|
||||||
|
endif
|
||||||
" It's only adding autocmd, so that no event occurs.
|
" It's only adding autocmd, so that no event occurs.
|
||||||
call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>")
|
call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>")
|
||||||
call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>")
|
call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>")
|
||||||
@ -3022,6 +3028,8 @@ func Test_autocmd_CmdWinEnter()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_autocmd_was_using_freed_memory()
|
func Test_autocmd_was_using_freed_memory()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
pedit xx
|
pedit xx
|
||||||
n x
|
n x
|
||||||
augroup winenter
|
augroup winenter
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
|
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
|
||||||
|
source check.vim
|
||||||
|
|
||||||
|
func Test_getbufwintabinfo()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
function Test_getbufwintabinfo()
|
|
||||||
edit Xtestfile1
|
edit Xtestfile1
|
||||||
edit Xtestfile2
|
edit Xtestfile2
|
||||||
let buflist = getbufinfo()
|
let buflist = getbufinfo()
|
||||||
@ -109,7 +112,7 @@ function Test_getbufwintabinfo()
|
|||||||
call assert_true(winlist[2].quickfix)
|
call assert_true(winlist[2].quickfix)
|
||||||
call assert_false(winlist[2].loclist)
|
call assert_false(winlist[2].loclist)
|
||||||
wincmd t | only
|
wincmd t | only
|
||||||
endfunction
|
endfunc
|
||||||
|
|
||||||
function Test_get_buf_options()
|
function Test_get_buf_options()
|
||||||
let opts = bufnr()->getbufvar('&')
|
let opts = bufnr()->getbufvar('&')
|
||||||
|
@ -1137,6 +1137,8 @@ func Test_edit_CTRL_V()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_edit_F1()
|
func Test_edit_F1()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
" Pressing <f1>
|
" Pressing <f1>
|
||||||
new
|
new
|
||||||
" call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
|
" call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')
|
||||||
|
@ -124,6 +124,8 @@ func Test_win_execute()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_win_execute_update_ruler()
|
func Test_win_execute_update_ruler()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
enew
|
enew
|
||||||
call setline(1, range(500))
|
call setline(1, range(500))
|
||||||
20
|
20
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
" Test the :filter command modifier
|
" Test the :filter command modifier
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
|
||||||
func Test_filter()
|
func Test_filter()
|
||||||
edit Xdoesnotmatch
|
edit Xdoesnotmatch
|
||||||
edit Xwillmatch
|
edit Xwillmatch
|
||||||
@ -97,6 +99,8 @@ func Test_filter_cmd_with_filter()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
func Test_filter_commands()
|
func Test_filter_commands()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
let g:test_filter_a = 1
|
let g:test_filter_a = 1
|
||||||
let b:test_filter_b = 2
|
let b:test_filter_b = 2
|
||||||
let test_filter_c = 3
|
let test_filter_c = 3
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
" Tests for 'makeencoding'.
|
" Tests for 'makeencoding'.
|
||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
|
source check.vim
|
||||||
|
|
||||||
|
CheckFeature quickfix
|
||||||
let s:python = PythonProg()
|
let s:python = PythonProg()
|
||||||
if s:python == ''
|
if s:python == ''
|
||||||
throw 'Skipped: python program missing'
|
throw 'Skipped: python program missing'
|
||||||
|
@ -257,6 +257,48 @@ func Test_mksession_lcd_multiple_tabs()
|
|||||||
call delete('Xtest_mks.out')
|
call delete('Xtest_mks.out')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for tabpage-local directory
|
||||||
|
func Test_mksession_tcd_multiple_tabs()
|
||||||
|
let save_cwd = getcwd()
|
||||||
|
call mkdir('Xtopdir')
|
||||||
|
cd Xtopdir
|
||||||
|
call mkdir('Xtabdir1')
|
||||||
|
call mkdir('Xtabdir2')
|
||||||
|
call mkdir('Xtabdir3')
|
||||||
|
call mkdir('Xwindir1')
|
||||||
|
call mkdir('Xwindir2')
|
||||||
|
call mkdir('Xwindir3')
|
||||||
|
tcd Xtabdir1
|
||||||
|
botright new
|
||||||
|
wincmd t
|
||||||
|
lcd ../Xwindir1
|
||||||
|
tabnew
|
||||||
|
tcd ../Xtabdir2
|
||||||
|
botright new
|
||||||
|
lcd ../Xwindir2
|
||||||
|
tabnew
|
||||||
|
tcd ../Xtabdir3
|
||||||
|
botright new
|
||||||
|
lcd ../Xwindir3
|
||||||
|
tabfirst
|
||||||
|
1wincmd w
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
only | tabonly
|
||||||
|
source Xtest_mks.out
|
||||||
|
call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 1), ':t'))
|
||||||
|
call assert_equal('Xwindir1', fnamemodify(getcwd(1, 1), ':t'))
|
||||||
|
call assert_equal('Xtabdir1', fnamemodify(getcwd(2, 1), ':t'))
|
||||||
|
call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 2), ':t'))
|
||||||
|
call assert_equal('Xtabdir2', fnamemodify(getcwd(1, 2), ':t'))
|
||||||
|
call assert_equal('Xwindir2', fnamemodify(getcwd(2, 2), ':t'))
|
||||||
|
call assert_equal('Xtabdir3', fnamemodify(getcwd(-1, 3), ':t'))
|
||||||
|
call assert_equal('Xtabdir3', fnamemodify(getcwd(1, 3), ':t'))
|
||||||
|
call assert_equal('Xwindir3', fnamemodify(getcwd(2, 3), ':t'))
|
||||||
|
%bwipe
|
||||||
|
call chdir(save_cwd)
|
||||||
|
call delete("Xtopdir", "rf")
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_mksession_blank_tabs()
|
func Test_mksession_blank_tabs()
|
||||||
tabnew
|
tabnew
|
||||||
tabnew
|
tabnew
|
||||||
@ -353,6 +395,112 @@ func Test_mksession_blank_windows()
|
|||||||
call delete('Xtest_mks.out')
|
call delete('Xtest_mks.out')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
if has('terminal')
|
||||||
|
|
||||||
|
func Test_mksession_terminal_shell()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
|
terminal
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
let term_cmd = line
|
||||||
|
elseif line =~ 'badd.*' . &shell
|
||||||
|
call assert_report('unexpected shell line: ' . line)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*.*$', term_cmd)
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_terminal_no_restore_cmdarg()
|
||||||
|
terminal ++norestore
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
call assert_report('session must not restore terminal')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_terminal_no_restore_funcarg()
|
||||||
|
call term_start(&shell, {'norestore': 1})
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
call assert_report('session must not restore terminal')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_terminal_no_restore_func()
|
||||||
|
terminal
|
||||||
|
call term_setrestore(bufnr('%'), 'NONE')
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
call assert_report('session must not restore terminal')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_terminal_no_ssop()
|
||||||
|
terminal
|
||||||
|
set sessionoptions-=terminal
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
call assert_report('session must not restore terminal')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
set sessionoptions&
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_terminal_restore_other()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
|
terminal
|
||||||
|
eval bufnr('%')->term_setrestore('other')
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
let lines = readfile('Xtest_mks.out')
|
||||||
|
let term_cmd = ''
|
||||||
|
for line in lines
|
||||||
|
if line =~ '^terminal'
|
||||||
|
let term_cmd = line
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+.*other', term_cmd)
|
||||||
|
|
||||||
|
call StopShellInTerminal(bufnr('%'))
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
endif " has('terminal')
|
||||||
|
|
||||||
func Test_mkview_open_folds()
|
func Test_mkview_open_folds()
|
||||||
enew!
|
enew!
|
||||||
|
|
||||||
@ -637,6 +785,7 @@ endfunc
|
|||||||
|
|
||||||
" Test for changing directory to the session file directory
|
" Test for changing directory to the session file directory
|
||||||
func Test_mksession_sesdir()
|
func Test_mksession_sesdir()
|
||||||
|
let save_cwd = getcwd()
|
||||||
call mkdir('Xproj')
|
call mkdir('Xproj')
|
||||||
mksession! Xproj/Xtest_mks1.out
|
mksession! Xproj/Xtest_mks1.out
|
||||||
set sessionoptions-=curdir
|
set sessionoptions-=curdir
|
||||||
@ -647,12 +796,42 @@ func Test_mksession_sesdir()
|
|||||||
call assert_equal('testdir', fnamemodify(getcwd(), ':t'))
|
call assert_equal('testdir', fnamemodify(getcwd(), ':t'))
|
||||||
source Xproj/Xtest_mks2.out
|
source Xproj/Xtest_mks2.out
|
||||||
call assert_equal('Xproj', fnamemodify(getcwd(), ':t'))
|
call assert_equal('Xproj', fnamemodify(getcwd(), ':t'))
|
||||||
cd ..
|
call chdir(save_cwd)
|
||||||
|
%bwipe
|
||||||
|
|
||||||
set sessionoptions&
|
set sessionoptions&
|
||||||
call delete('Xproj', 'rf')
|
call delete('Xproj', 'rf')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for saving and restoring the tab-local working directory when there is
|
||||||
|
" only a single tab and 'tabpages' is not in 'sessionoptions'.
|
||||||
|
func Test_mksession_tcd_single_tabs()
|
||||||
|
only | tabonly
|
||||||
|
|
||||||
|
let save_cwd = getcwd()
|
||||||
|
set sessionoptions-=tabpages
|
||||||
|
set sessionoptions+=curdir
|
||||||
|
call mkdir('Xtopdir1')
|
||||||
|
call mkdir('Xtopdir2')
|
||||||
|
|
||||||
|
" There are two tab pages, the current one has local cwd set to 'Xtopdir2'.
|
||||||
|
exec 'tcd ' .. save_cwd .. '/Xtopdir1'
|
||||||
|
tabnew
|
||||||
|
exec 'tcd ' .. save_cwd .. '/Xtopdir2'
|
||||||
|
mksession! Xtest_tcd_single
|
||||||
|
|
||||||
|
source Xtest_tcd_single
|
||||||
|
" call assert_equal(2, haslocaldir())
|
||||||
|
call assert_equal(1, haslocaldir(-1))
|
||||||
|
call assert_equal('Xtopdir2', fnamemodify(getcwd(-1, 0), ':t'))
|
||||||
|
%bwipe
|
||||||
|
|
||||||
|
set sessionoptions&
|
||||||
|
call chdir(save_cwd)
|
||||||
|
call delete('Xtopdir1', 'rf')
|
||||||
|
call delete('Xtopdir2', 'rf')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for storing the 'lines' and 'columns' settings
|
" Test for storing the 'lines' and 'columns' settings
|
||||||
func Test_mksession_resize()
|
func Test_mksession_resize()
|
||||||
mksession! Xtest_mks1.out
|
mksession! Xtest_mks1.out
|
||||||
|
@ -1923,6 +1923,8 @@ func Test_normal24_rot13()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_normal25_tag()
|
func Test_normal25_tag()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
" Testing for CTRL-] g CTRL-] g]
|
" Testing for CTRL-] g CTRL-] g]
|
||||||
" CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
|
" CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
|
||||||
h
|
h
|
||||||
|
@ -501,6 +501,8 @@ endfunc
|
|||||||
" Test that 'completefunc' on Scratch buffer with preview window works when
|
" Test that 'completefunc' on Scratch buffer with preview window works when
|
||||||
" it's OK.
|
" it's OK.
|
||||||
func Test_completefunc_with_scratch_buffer()
|
func Test_completefunc_with_scratch_buffer()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
|
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
|
||||||
set completeopt+=preview
|
set completeopt+=preview
|
||||||
setlocal completefunc=DummyCompleteFive
|
setlocal completefunc=DummyCompleteFive
|
||||||
@ -710,14 +712,13 @@ func Test_popup_and_window_resize()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_popup_and_preview_autocommand()
|
func Test_popup_and_preview_autocommand()
|
||||||
|
CheckFeature python
|
||||||
|
CheckFeature quickfix
|
||||||
|
if winheight(0) < 15
|
||||||
|
throw 'Skipped: window height insufficient'
|
||||||
|
endif
|
||||||
|
|
||||||
" This used to crash Vim
|
" This used to crash Vim
|
||||||
if !has('python')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let h = winheight(0)
|
|
||||||
if h < 15
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
new
|
new
|
||||||
augroup MyBufAdd
|
augroup MyBufAdd
|
||||||
au!
|
au!
|
||||||
@ -821,9 +822,8 @@ func Test_balloon_split()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_popup_position()
|
func Test_popup_position()
|
||||||
if !CanRunVimInTerminal()
|
CheckScreendump
|
||||||
return
|
|
||||||
endif
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
123456789_123456789_123456789_a
|
123456789_123456789_123456789_a
|
||||||
123456789_123456789_123456789_b
|
123456789_123456789_123456789_b
|
||||||
|
@ -4,6 +4,8 @@ source screendump.vim
|
|||||||
source check.vim
|
source check.vim
|
||||||
|
|
||||||
function Test_tabpage()
|
function Test_tabpage()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
bw!
|
bw!
|
||||||
" Simple test for opening and closing a tab page
|
" Simple test for opening and closing a tab page
|
||||||
tabnew
|
tabnew
|
||||||
@ -273,6 +275,8 @@ function Test_tabpage_with_autocmd_tab_drop()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function Test_tabpage_with_tab_modifier()
|
function Test_tabpage_with_tab_modifier()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
for n in range(4)
|
for n in range(4)
|
||||||
tabedit
|
tabedit
|
||||||
endfor
|
endfor
|
||||||
|
@ -508,6 +508,8 @@ func Test_equalalways_on_close()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_win_screenpos()
|
func Test_win_screenpos()
|
||||||
|
CheckFeature quickfix
|
||||||
|
|
||||||
call assert_equal(1, winnr('$'))
|
call assert_equal(1, winnr('$'))
|
||||||
split
|
split
|
||||||
vsplit
|
vsplit
|
||||||
|
Loading…
Reference in New Issue
Block a user