mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #7325 from jamessan/vim-8.0.0112
vim-patch:8.0.0112,8.0.0253,8.0.0258,8.0.1024,8.0.1025
This commit is contained in:
commit
542ed5f5d3
@ -8810,11 +8810,12 @@ makeopens (
|
||||
&& buf->b_fname != NULL
|
||||
&& buf->b_p_bl) {
|
||||
if (fprintf(fd, "badd +%" PRId64 " ",
|
||||
buf->b_wininfo == NULL ?
|
||||
(int64_t)1L :
|
||||
(int64_t)buf->b_wininfo->wi_fpos.lnum) < 0
|
||||
|| ses_fname(fd, buf, &ssop_flags) == FAIL)
|
||||
buf->b_wininfo == NULL
|
||||
? (int64_t)1L
|
||||
: (int64_t)buf->b_wininfo->wi_fpos.lnum) < 0
|
||||
|| ses_fname(fd, buf, &ssop_flags, true) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8885,11 +8886,13 @@ makeopens (
|
||||
&& !bt_nofile(wp->w_buffer)
|
||||
) {
|
||||
if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
|
||||
|| ses_fname(fd, wp->w_buffer, &ssop_flags, true) == FAIL) {
|
||||
return FAIL;
|
||||
need_tabnew = FALSE;
|
||||
if (!wp->w_arg_idx_invalid)
|
||||
}
|
||||
need_tabnew = false;
|
||||
if (!wp->w_arg_idx_invalid) {
|
||||
edited_win = wp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8933,6 +8936,8 @@ makeopens (
|
||||
// resized when moving between windows.
|
||||
// Do this before restoring the view, so that the topline and the
|
||||
// cursor can be set. This is done again below.
|
||||
// winminheight and winminwidth need to be set to avoid an error if the
|
||||
// user has set winheight or winwidth.
|
||||
if (put_line(fd, "set winminheight=1 winminwidth=1 winheight=1 winwidth=1")
|
||||
== FAIL) {
|
||||
return FAIL;
|
||||
@ -9221,24 +9226,35 @@ put_view (
|
||||
if (wp->w_buffer->b_ffname != NULL
|
||||
&& (!bt_nofile(wp->w_buffer) || wp->w_buffer->terminal)
|
||||
) {
|
||||
/*
|
||||
* Editing a file in this buffer: use ":edit file".
|
||||
* This may have side effects! (e.g., compressed or network file).
|
||||
*/
|
||||
if (fputs("edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
|
||||
// Editing a file in this buffer: use ":edit file".
|
||||
// This may have side effects! (e.g., compressed or network file).
|
||||
//
|
||||
// Note, if a buffer for that file already exists, use :badd to
|
||||
// edit that buffer, to not lose folding information (:edit resets
|
||||
// folds in other buffers)
|
||||
if (fputs("if bufexists('", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, false) == FAIL
|
||||
|| fputs("') | buffer ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, false) == FAIL
|
||||
|| fputs(" | else | edit ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, false) == FAIL
|
||||
|| fputs(" | endif", fd) < 0
|
||||
|| put_eol(fd) == FAIL) {
|
||||
return FAIL;
|
||||
} else {
|
||||
/* No file in this buffer, just make it empty. */
|
||||
if (put_line(fd, "enew") == FAIL)
|
||||
return FAIL;
|
||||
if (wp->w_buffer->b_ffname != NULL) {
|
||||
/* The buffer does have a name, but it's not a file name. */
|
||||
if (fputs("file ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
do_cursor = FALSE;
|
||||
} else {
|
||||
// No file in this buffer, just make it empty.
|
||||
if (put_line(fd, "enew") == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
if (wp->w_buffer->b_ffname != NULL) {
|
||||
// The buffer does have a name, but it's not a file name.
|
||||
if (fputs("file ", fd) < 0
|
||||
|| ses_fname(fd, wp->w_buffer, flagp, true) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
do_cursor = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9389,12 +9405,10 @@ ses_arglist (
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a buffer name to the session file.
|
||||
* Also ends the line.
|
||||
* Returns FAIL if writing fails.
|
||||
*/
|
||||
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
|
||||
/// Write a buffer name to the session file.
|
||||
/// Also ends the line, if "add_eol" is true.
|
||||
/// Returns FAIL if writing fails.
|
||||
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, bool add_eol)
|
||||
{
|
||||
char_u *name;
|
||||
|
||||
@ -9411,8 +9425,10 @@ static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp)
|
||||
name = buf->b_sfname;
|
||||
else
|
||||
name = buf->b_ffname;
|
||||
if (ses_put_fname(fd, name, flagp) == FAIL || put_eol(fd) == FAIL)
|
||||
if (ses_put_fname(fd, name, flagp) == FAIL
|
||||
|| (add_eol && put_eol(fd) == FAIL)) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,113 @@
|
||||
" Tests for sessions
|
||||
" Test for :mksession, :mkview and :loadview in latin1 encoding
|
||||
|
||||
scriptencoding latin1
|
||||
|
||||
if !has('multi_byte') || !has('mksession')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_mksession()
|
||||
tabnew
|
||||
let wrap_save = &wrap
|
||||
set sessionoptions=buffers splitbelow fileencoding=latin1
|
||||
call setline(1, [
|
||||
\ 'start:',
|
||||
\ 'no multibyte chAracter',
|
||||
\ ' one leaDing tab',
|
||||
\ ' four leadinG spaces',
|
||||
\ 'two consecutive tabs',
|
||||
\ 'two tabs in one line',
|
||||
\ 'one ä multibyteCharacter',
|
||||
\ 'aä Ä two multiByte characters',
|
||||
\ 'Aäöü three mulTibyte characters'
|
||||
\ ])
|
||||
let tmpfile = 'Xtemp'
|
||||
exec 'w! ' . tmpfile
|
||||
/^start:
|
||||
set wrap
|
||||
vsplit
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j8|
|
||||
split
|
||||
norm! j8|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
wincmd l
|
||||
|
||||
set nowrap
|
||||
/^start:
|
||||
norm! j16|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j08|3zl
|
||||
split
|
||||
norm! j08|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
call wincol()
|
||||
mksession! Xtest_mks.out
|
||||
let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
|
||||
let expected = [
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 08|',
|
||||
\ 'normal! 08|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
||||
\ " normal! 08|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
||||
\ " normal! 08|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|"
|
||||
\ ]
|
||||
call assert_equal(expected, li)
|
||||
tabclose!
|
||||
|
||||
call delete('Xtest_mks.out')
|
||||
call delete(tmpfile)
|
||||
let &wrap = wrap_save
|
||||
endfunc
|
||||
|
||||
func Test_mksession_winheight()
|
||||
new
|
||||
set winheight=10 winminheight=2
|
||||
mksession! Xtest_mks.out
|
||||
source Xtest_mks.out
|
||||
|
||||
call delete('Xtest_mks.out')
|
||||
endfunc
|
||||
|
||||
" Verify that arglist is stored correctly to the session file.
|
||||
func Test_mksession_arglist()
|
||||
@ -12,4 +121,35 @@ func Test_mksession_arglist()
|
||||
argdel *
|
||||
endfunc
|
||||
|
||||
|
||||
func Test_mksession_one_buffer_two_windows()
|
||||
edit Xtest1
|
||||
new Xtest2
|
||||
split
|
||||
mksession! Xtest_mks.out
|
||||
let lines = readfile('Xtest_mks.out')
|
||||
let count1 = 0
|
||||
let count2 = 0
|
||||
let count2buf = 0
|
||||
for line in lines
|
||||
if line =~ 'edit \f*Xtest1$'
|
||||
let count1 += 1
|
||||
endif
|
||||
if line =~ 'edit \f\{-}Xtest2'
|
||||
let count2 += 1
|
||||
endif
|
||||
if line =~ 'buffer \f\{-}Xtest2'
|
||||
let count2buf += 1
|
||||
endif
|
||||
endfor
|
||||
call assert_equal(1, count1, 'Xtest1 count')
|
||||
call assert_equal(2, count2, 'Xtest2 count')
|
||||
call assert_equal(2, count2buf, 'Xtest2 buffer count')
|
||||
|
||||
close
|
||||
bwipe!
|
||||
call delete('Xtest_mks.out')
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
104
src/nvim/testdir/test_mksession_utf8.vim
Normal file
104
src/nvim/testdir/test_mksession_utf8.vim
Normal file
@ -0,0 +1,104 @@
|
||||
" Test for :mksession, :mkview and :loadview in utf-8 encoding
|
||||
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
if !has('multi_byte') || !has('mksession')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_mksession_utf8()
|
||||
tabnew
|
||||
let wrap_save = &wrap
|
||||
set sessionoptions=buffers splitbelow fileencoding=utf-8
|
||||
call setline(1, [
|
||||
\ 'start:',
|
||||
\ 'no multibyte chAracter',
|
||||
\ ' one leaDing tab',
|
||||
\ ' four leadinG spaces',
|
||||
\ 'two consecutive tabs',
|
||||
\ 'two tabs in one line',
|
||||
\ 'one … multibyteCharacter',
|
||||
\ 'a “b” two multiByte characters',
|
||||
\ '“c”1€ three mulTibyte characters'
|
||||
\ ])
|
||||
let tmpfile = tempname()
|
||||
exec 'w! ' . tmpfile
|
||||
/^start:
|
||||
set wrap
|
||||
vsplit
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j8|
|
||||
split
|
||||
norm! j8|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
split
|
||||
norm! j16|
|
||||
wincmd l
|
||||
|
||||
set nowrap
|
||||
/^start:
|
||||
norm! j16|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j08|3zl
|
||||
split
|
||||
norm! j08|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
norm! j016|3zl
|
||||
split
|
||||
call wincol()
|
||||
mksession! test_mks.out
|
||||
let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
|
||||
let expected = [
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 08|',
|
||||
\ 'normal! 08|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ 'normal! 016|',
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
||||
\ " normal! 08|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
|
||||
\ " normal! 08|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|",
|
||||
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
|
||||
\ " normal! 016|"
|
||||
\ ]
|
||||
call assert_equal(expected, li)
|
||||
tabclose!
|
||||
|
||||
call delete('test_mks.out')
|
||||
call delete(tmpfile)
|
||||
let &wrap = wrap_save
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
@ -77,6 +77,157 @@ static char *features[] = {
|
||||
|
||||
// clang-format off
|
||||
static const int included_patches[] = {
|
||||
// 1026,
|
||||
1025,
|
||||
1024,
|
||||
// 1023,
|
||||
// 1022,
|
||||
// 1021,
|
||||
// 1020,
|
||||
// 1019,
|
||||
// 1018,
|
||||
// 1017,
|
||||
// 1016,
|
||||
// 1015,
|
||||
// 1014,
|
||||
// 1013,
|
||||
// 1012,
|
||||
// 1011,
|
||||
// 1010,
|
||||
// 1009,
|
||||
// 1008,
|
||||
// 1007,
|
||||
// 1006,
|
||||
// 1005,
|
||||
// 1004,
|
||||
// 1003,
|
||||
// 1002,
|
||||
// 1001,
|
||||
// 1000,
|
||||
// 999,
|
||||
// 998,
|
||||
// 997,
|
||||
// 996,
|
||||
// 995,
|
||||
// 994,
|
||||
// 993,
|
||||
// 992,
|
||||
// 991,
|
||||
// 990,
|
||||
// 989,
|
||||
// 988,
|
||||
// 987,
|
||||
// 986,
|
||||
// 985,
|
||||
// 984,
|
||||
// 983,
|
||||
// 982,
|
||||
// 981,
|
||||
// 980,
|
||||
// 979,
|
||||
// 978,
|
||||
// 977,
|
||||
// 976,
|
||||
// 975,
|
||||
// 974,
|
||||
// 973,
|
||||
// 972,
|
||||
// 971,
|
||||
// 970,
|
||||
// 969,
|
||||
// 968,
|
||||
// 967,
|
||||
// 966,
|
||||
// 965,
|
||||
// 964,
|
||||
// 963,
|
||||
// 962,
|
||||
// 961,
|
||||
// 960,
|
||||
// 959,
|
||||
// 958,
|
||||
// 957,
|
||||
// 956,
|
||||
// 955,
|
||||
// 954,
|
||||
// 953,
|
||||
// 952,
|
||||
// 951,
|
||||
// 950,
|
||||
// 949,
|
||||
// 948,
|
||||
// 947,
|
||||
// 946,
|
||||
// 945,
|
||||
// 944,
|
||||
// 943,
|
||||
// 942,
|
||||
// 941,
|
||||
// 940,
|
||||
// 939,
|
||||
// 938,
|
||||
// 937,
|
||||
// 936,
|
||||
// 935,
|
||||
// 934,
|
||||
// 933,
|
||||
// 932,
|
||||
// 931,
|
||||
// 930,
|
||||
// 929,
|
||||
// 928,
|
||||
// 927,
|
||||
// 926,
|
||||
// 925,
|
||||
// 924,
|
||||
// 923,
|
||||
// 922,
|
||||
// 921,
|
||||
// 920,
|
||||
// 919,
|
||||
// 918,
|
||||
// 917,
|
||||
// 916,
|
||||
// 915,
|
||||
// 914,
|
||||
// 913,
|
||||
// 912,
|
||||
// 911,
|
||||
// 910,
|
||||
// 909,
|
||||
// 908,
|
||||
// 907,
|
||||
// 906,
|
||||
// 905,
|
||||
// 904,
|
||||
// 903,
|
||||
// 902,
|
||||
// 901,
|
||||
// 900,
|
||||
// 899,
|
||||
// 898,
|
||||
// 897,
|
||||
// 896,
|
||||
// 895,
|
||||
// 894,
|
||||
// 893,
|
||||
// 892,
|
||||
// 891,
|
||||
// 890,
|
||||
// 889,
|
||||
// 888,
|
||||
// 887,
|
||||
// 886,
|
||||
// 885,
|
||||
// 884,
|
||||
// 883,
|
||||
// 882,
|
||||
// 881,
|
||||
// 880,
|
||||
// 879,
|
||||
// 878,
|
||||
// 877,
|
||||
// 876,
|
||||
// 875,
|
||||
// 874,
|
||||
// 873,
|
||||
@ -694,12 +845,12 @@ static const int included_patches[] = {
|
||||
// 261,
|
||||
// 260 NA
|
||||
259,
|
||||
// 258,
|
||||
258,
|
||||
// 257 NA
|
||||
// 256,
|
||||
// 255,
|
||||
// 254,
|
||||
// 253,
|
||||
253,
|
||||
// 252,
|
||||
// 251,
|
||||
250,
|
||||
@ -840,7 +991,7 @@ static const int included_patches[] = {
|
||||
// 115 NA
|
||||
// 114 NA
|
||||
// 113 NA
|
||||
// 112,
|
||||
112,
|
||||
111,
|
||||
110,
|
||||
// 109 NA
|
||||
|
Loading…
Reference in New Issue
Block a user