comparison src/session.c @ 26956:86f8718c643d v8.2.4007

patch 8.2.4007: session does not restore help buffer properly Commit: https://github.com/vim/vim/commit/8e7d9db32b53ca2b1cb7570d2042860bcd1e943f Author: matveyt <matthewtarasov@gmail.com> Date: Wed Jan 5 14:01:30 2022 +0000 patch 8.2.4007: session does not restore help buffer properly Problem: Session does not restore help buffer properly when "options' is missing from 'sessionoptions'. Solution: Use a ":help" command to create the help window. (closes #9475, closes #9458, closes #9472)
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Jan 2022 15:15:03 +0100
parents 06a137af96f8
children 4fd87205ca80
comparison
equal deleted inserted replaced
26955:fe5fc1a23b09 26956:86f8718c643d
346 } 346 }
347 347
348 // Edit the file. Skip this when ":next" already did it. 348 // Edit the file. Skip this when ":next" already did it.
349 if (add_edit && (!did_next || wp->w_arg_idx_invalid)) 349 if (add_edit && (!did_next || wp->w_arg_idx_invalid))
350 { 350 {
351 if (bt_help(wp->w_buffer))
352 {
353 char *curtag = "";
354
355 // A help buffer needs some options to be set.
356 // First, create a new empty buffer with "buftype=help".
357 // Then ":help" will re-use both the buffer and the window and set
358 // the options, even when "options" is not in 'sessionoptions'.
359 if (0 < wp->w_tagstackidx
360 && wp->w_tagstackidx <= wp->w_tagstacklen)
361 curtag = (char *)wp->w_tagstack[wp->w_tagstackidx - 1].tagname;
362
363 if (put_line(fd, "enew | setl bt=help") == FAIL
364 || fprintf(fd, "help %s", curtag) < 0
365 || put_eol(fd) == FAIL)
366 return FAIL;
367 }
351 # ifdef FEAT_TERMINAL 368 # ifdef FEAT_TERMINAL
352 if (bt_terminal(wp->w_buffer)) 369 else if (bt_terminal(wp->w_buffer))
353 { 370 {
354 if (term_write_session(fd, wp, terminal_bufs) == FAIL) 371 if (term_write_session(fd, wp, terminal_bufs) == FAIL)
355 return FAIL; 372 return FAIL;
356 } 373 }
357 else
358 # endif 374 # endif
359 // Load the file. 375 // Load the file.
360 if (wp->w_buffer->b_ffname != NULL 376 else if (wp->w_buffer->b_ffname != NULL
361 # ifdef FEAT_QUICKFIX 377 # ifdef FEAT_QUICKFIX
362 && !bt_nofilename(wp->w_buffer) 378 && !bt_nofilename(wp->w_buffer)
363 # endif 379 # endif
364 ) 380 )
365 { 381 {