mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #16951 from zeertzjq/vim-8.2.4007
This commit is contained in:
commit
af9a2a201d
@ -338,14 +338,26 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
|
|
||||||
// Edit the file. Skip this when ":next" already did it.
|
// Edit the file. Skip this when ":next" already did it.
|
||||||
if (add_edit && (!did_next || wp->w_arg_idx_invalid)) {
|
if (add_edit && (!did_next || wp->w_arg_idx_invalid)) {
|
||||||
char *fname_esc =
|
char *fname_esc = ses_escape_fname(ses_get_fname(wp->w_buffer, flagp), flagp);
|
||||||
ses_escape_fname(ses_get_fname(wp->w_buffer, flagp), flagp);
|
if (bt_help(wp->w_buffer)) {
|
||||||
//
|
char *curtag = "";
|
||||||
// Load the file.
|
|
||||||
//
|
// A help buffer needs some options to be set.
|
||||||
if (wp->w_buffer->b_ffname != NULL
|
// First, create a new empty buffer with "buftype=help".
|
||||||
&& (!bt_nofile(wp->w_buffer)
|
// Then ":help" will re-use both the buffer and the window and set
|
||||||
|| wp->w_buffer->terminal)) {
|
// the options, even when "options" is not in 'sessionoptions'.
|
||||||
|
if (0 < wp->w_tagstackidx && wp->w_tagstackidx <= wp->w_tagstacklen) {
|
||||||
|
curtag = (char *)wp->w_tagstack[wp->w_tagstackidx - 1].tagname;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (put_line(fd, "enew | setl bt=help") == FAIL
|
||||||
|
|| fprintf(fd, "help %s", curtag) < 0 || put_eol(fd) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
} else if (wp->w_buffer->b_ffname != NULL
|
||||||
|
&& (!bt_nofile(wp->w_buffer) || wp->w_buffer->terminal)) {
|
||||||
|
// Load the file.
|
||||||
|
|
||||||
// Editing a file in this buffer: use ":edit file".
|
// Editing a file in this buffer: use ":edit file".
|
||||||
// This may have side effects! (e.g., compressed or network file).
|
// This may have side effects! (e.g., compressed or network file).
|
||||||
//
|
//
|
||||||
|
@ -696,6 +696,36 @@ func Test_mksession_foldopt()
|
|||||||
set sessionoptions&
|
set sessionoptions&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for mksession with "help" but not "options" in 'sessionoptions'
|
||||||
|
func Test_mksession_help_noopt()
|
||||||
|
set sessionoptions-=options
|
||||||
|
set sessionoptions+=help
|
||||||
|
help
|
||||||
|
let fname = expand('%')
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
bwipe
|
||||||
|
|
||||||
|
source Xtest_mks.out
|
||||||
|
call assert_equal('help', &buftype)
|
||||||
|
call assert_equal('help', &filetype)
|
||||||
|
call assert_equal(fname, expand('%'))
|
||||||
|
call assert_false(&modifiable)
|
||||||
|
call assert_true(&readonly)
|
||||||
|
|
||||||
|
helpclose
|
||||||
|
help index
|
||||||
|
let fname = expand('%')
|
||||||
|
mksession! Xtest_mks.out
|
||||||
|
bwipe
|
||||||
|
|
||||||
|
source Xtest_mks.out
|
||||||
|
call assert_equal('help', &buftype)
|
||||||
|
call assert_equal(fname, expand('%'))
|
||||||
|
|
||||||
|
call delete('Xtest_mks.out')
|
||||||
|
set sessionoptions&
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for mksession with window position
|
" Test for mksession with window position
|
||||||
func Test_mksession_winpos()
|
func Test_mksession_winpos()
|
||||||
if !has('gui_running')
|
if !has('gui_running')
|
||||||
|
Loading…
Reference in New Issue
Block a user