comparison src/session.c @ 22226:4ed106deb772 v8.2.1662

patch 8.2.1662: :mksession does not restore shared terminal buffer properly Commit: https://github.com/vim/vim/commit/0e655111e9dbdbdf69fee1b199f2b9c355bf4a10 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 11 20:36:36 2020 +0200 patch 8.2.1662: :mksession does not restore shared terminal buffer properly Problem: :mksession does not restore shared terminal buffer properly. Solution: Keep a hashtab with terminal buffers. (Rob Pilling, closes https://github.com/vim/vim/issues/6930)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Sep 2020 20:45:04 +0200
parents 407351a89c61
children 0bbc8be90207
comparison
equal deleted inserted replaced
22225:4d538e35eebd 22226:4ed106deb772
303 put_view( 303 put_view(
304 FILE *fd, 304 FILE *fd,
305 win_T *wp, 305 win_T *wp,
306 int add_edit, // add ":edit" command to view 306 int add_edit, // add ":edit" command to view
307 unsigned *flagp, // vop_flags or ssop_flags 307 unsigned *flagp, // vop_flags or ssop_flags
308 int current_arg_idx) // current argument index of the window, use 308 int current_arg_idx // current argument index of the window, use
309 // -1 if unknown 309 // -1 if unknown
310 #ifdef FEAT_TERMINAL
311 , hashtab_T *terminal_bufs
312 #endif
313 )
310 { 314 {
311 win_T *save_curwin; 315 win_T *save_curwin;
312 int f; 316 int f;
313 int do_cursor; 317 int do_cursor;
314 int did_next = FALSE; 318 int did_next = FALSE;
347 if (add_edit && (!did_next || wp->w_arg_idx_invalid)) 351 if (add_edit && (!did_next || wp->w_arg_idx_invalid))
348 { 352 {
349 # ifdef FEAT_TERMINAL 353 # ifdef FEAT_TERMINAL
350 if (bt_terminal(wp->w_buffer)) 354 if (bt_terminal(wp->w_buffer))
351 { 355 {
352 if (term_write_session(fd, wp) == FAIL) 356 if (term_write_session(fd, wp, terminal_bufs) == FAIL)
353 return FAIL; 357 return FAIL;
354 } 358 }
355 else 359 else
356 # endif 360 # endif
357 // Load the file. 361 // Load the file.
586 int restore_stal = FALSE; 590 int restore_stal = FALSE;
587 win_T *tab_firstwin; 591 win_T *tab_firstwin;
588 frame_T *tab_topframe; 592 frame_T *tab_topframe;
589 int cur_arg_idx = 0; 593 int cur_arg_idx = 0;
590 int next_arg_idx = 0; 594 int next_arg_idx = 0;
595 int ret = FAIL;
596 #ifdef FEAT_TERMINAL
597 hashtab_T terminal_bufs;
598
599 hash_init(&terminal_bufs);
600 #endif
591 601
592 if (ssop_flags & SSOP_BUFFERS) 602 if (ssop_flags & SSOP_BUFFERS)
593 only_save_windows = FALSE; // Save ALL buffers 603 only_save_windows = FALSE; // Save ALL buffers
594 604
595 // Begin by setting the this_session variable, and then other 605 // Begin by setting the this_session variable, and then other
596 // sessionable variables. 606 // sessionable variables.
597 #ifdef FEAT_EVAL 607 #ifdef FEAT_EVAL
598 if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL) 608 if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL)
599 return FAIL; 609 goto fail;
600 if (ssop_flags & SSOP_GLOBALS) 610 if (ssop_flags & SSOP_GLOBALS)
601 if (store_session_globals(fd) == FAIL) 611 if (store_session_globals(fd) == FAIL)
602 return FAIL; 612 goto fail;
603 #endif 613 #endif
604 614
605 // Close all windows and tabs but one. 615 // Close all windows and tabs but one.
606 if (put_line(fd, "silent only") == FAIL) 616 if (put_line(fd, "silent only") == FAIL)
607 return FAIL; 617 goto fail;
608 if ((ssop_flags & SSOP_TABPAGES) 618 if ((ssop_flags & SSOP_TABPAGES)
609 && put_line(fd, "silent tabonly") == FAIL) 619 && put_line(fd, "silent tabonly") == FAIL)
610 return FAIL; 620 goto fail;
611 621
612 // Now a :cd command to the session directory or the current directory 622 // Now a :cd command to the session directory or the current directory
613 if (ssop_flags & SSOP_SESDIR) 623 if (ssop_flags & SSOP_SESDIR)
614 { 624 {
615 if (put_line(fd, "exe \"cd \" . escape(expand(\"<sfile>:p:h\"), ' ')") 625 if (put_line(fd, "exe \"cd \" . escape(expand(\"<sfile>:p:h\"), ' ')")
616 == FAIL) 626 == FAIL)
617 return FAIL; 627 goto fail;
618 } 628 }
619 else if (ssop_flags & SSOP_CURDIR) 629 else if (ssop_flags & SSOP_CURDIR)
620 { 630 {
621 sname = home_replace_save(NULL, globaldir != NULL ? globaldir : dirnow); 631 sname = home_replace_save(NULL, globaldir != NULL ? globaldir : dirnow);
622 if (sname == NULL 632 if (sname == NULL
623 || fputs("cd ", fd) < 0 633 || fputs("cd ", fd) < 0
624 || ses_put_fname(fd, sname, &ssop_flags) == FAIL 634 || ses_put_fname(fd, sname, &ssop_flags) == FAIL
625 || put_eol(fd) == FAIL) 635 || put_eol(fd) == FAIL)
626 { 636 {
627 vim_free(sname); 637 vim_free(sname);
628 return FAIL; 638 goto fail;
629 } 639 }
630 vim_free(sname); 640 vim_free(sname);
631 } 641 }
632 642
633 // If there is an empty, unnamed buffer we will wipe it out later. 643 // If there is an empty, unnamed buffer we will wipe it out later.
634 // Remember the buffer number. 644 // Remember the buffer number.
635 if (put_line(fd, "if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''") == FAIL) 645 if (put_line(fd, "if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''") == FAIL)
636 return FAIL; 646 goto fail;
637 if (put_line(fd, " let s:wipebuf = bufnr('%')") == FAIL) 647 if (put_line(fd, " let s:wipebuf = bufnr('%')") == FAIL)
638 return FAIL; 648 goto fail;
639 if (put_line(fd, "endif") == FAIL) 649 if (put_line(fd, "endif") == FAIL)
640 return FAIL; 650 goto fail;
641 651
642 // Now save the current files, current buffer first. 652 // Now save the current files, current buffer first.
643 if (put_line(fd, "set shortmess=aoO") == FAIL) 653 if (put_line(fd, "set shortmess=aoO") == FAIL)
644 return FAIL; 654 goto fail;
645 655
646 // the global argument list 656 // the global argument list
647 if (ses_arglist(fd, "argglobal", &global_alist.al_ga, 657 if (ses_arglist(fd, "argglobal", &global_alist.al_ga,
648 !(ssop_flags & SSOP_CURDIR), &ssop_flags) == FAIL) 658 !(ssop_flags & SSOP_CURDIR), &ssop_flags) == FAIL)
649 return FAIL; 659 goto fail;
650 660
651 if (ssop_flags & SSOP_RESIZE) 661 if (ssop_flags & SSOP_RESIZE)
652 { 662 {
653 // Note: after the restore we still check it worked! 663 // Note: after the restore we still check it worked!
654 if (fprintf(fd, "set lines=%ld columns=%ld" , Rows, Columns) < 0 664 if (fprintf(fd, "set lines=%ld columns=%ld" , Rows, Columns) < 0
655 || put_eol(fd) == FAIL) 665 || put_eol(fd) == FAIL)
656 return FAIL; 666 goto fail;
657 } 667 }
658 668
659 #ifdef FEAT_GUI 669 #ifdef FEAT_GUI
660 if (gui.in_use && (ssop_flags & SSOP_WINPOS)) 670 if (gui.in_use && (ssop_flags & SSOP_WINPOS))
661 { 671 {
663 673
664 if (gui_mch_get_winpos(&x, &y) == OK) 674 if (gui_mch_get_winpos(&x, &y) == OK)
665 { 675 {
666 // Note: after the restore we still check it worked! 676 // Note: after the restore we still check it worked!
667 if (fprintf(fd, "winpos %d %d", x, y) < 0 || put_eol(fd) == FAIL) 677 if (fprintf(fd, "winpos %d %d", x, y) < 0 || put_eol(fd) == FAIL)
668 return FAIL; 678 goto fail;
669 } 679 }
670 } 680 }
671 #endif 681 #endif
672 682
673 // When there are two or more tabpages and 'showtabline' is 1 the tabline 683 // When there are two or more tabpages and 'showtabline' is 1 the tabline
675 // in the first tab, which may cause problems. Set 'showtabline' to 2 685 // in the first tab, which may cause problems. Set 'showtabline' to 2
676 // temporarily to avoid that. 686 // temporarily to avoid that.
677 if (p_stal == 1 && first_tabpage->tp_next != NULL) 687 if (p_stal == 1 && first_tabpage->tp_next != NULL)
678 { 688 {
679 if (put_line(fd, "set stal=2") == FAIL) 689 if (put_line(fd, "set stal=2") == FAIL)
680 return FAIL; 690 goto fail;
681 restore_stal = TRUE; 691 restore_stal = TRUE;
682 } 692 }
683 693
684 // May repeat putting Windows for each tab, when "tabpages" is in 694 // May repeat putting Windows for each tab, when "tabpages" is in
685 // 'sessionoptions'. 695 // 'sessionoptions'.
693 703
694 // Similar to ses_win_rec() below, populate the tab pages first so 704 // Similar to ses_win_rec() below, populate the tab pages first so
695 // later local options won't be copied to the new tabs. 705 // later local options won't be copied to the new tabs.
696 FOR_ALL_TABPAGES(tp) 706 FOR_ALL_TABPAGES(tp)
697 if (tp->tp_next != NULL && put_line(fd, "tabnew") == FAIL) 707 if (tp->tp_next != NULL && put_line(fd, "tabnew") == FAIL)
698 return FAIL; 708 goto fail;
699 if (first_tabpage->tp_next != NULL && put_line(fd, "tabrewind") == FAIL) 709 if (first_tabpage->tp_next != NULL && put_line(fd, "tabrewind") == FAIL)
700 return FAIL; 710 goto fail;
701 } 711 }
702 for (tabnr = 1; ; ++tabnr) 712 for (tabnr = 1; ; ++tabnr)
703 { 713 {
704 tabpage_T *tp = NULL; 714 tabpage_T *tp = NULL;
705 int need_tabnext = FALSE; 715 int need_tabnext = FALSE;
737 && !bt_nofilename(wp->w_buffer) 747 && !bt_nofilename(wp->w_buffer)
738 #endif 748 #endif
739 ) 749 )
740 { 750 {
741 if (need_tabnext && put_line(fd, "tabnext") == FAIL) 751 if (need_tabnext && put_line(fd, "tabnext") == FAIL)
742 return FAIL; 752 goto fail;
743 need_tabnext = FALSE; 753 need_tabnext = FALSE;
744 754
745 if (fputs("edit ", fd) < 0 755 if (fputs("edit ", fd) < 0
746 || ses_fname(fd, wp->w_buffer, &ssop_flags, TRUE) 756 || ses_fname(fd, wp->w_buffer, &ssop_flags, TRUE)
747 == FAIL) 757 == FAIL)
748 return FAIL; 758 goto fail;
749 if (!wp->w_arg_idx_invalid) 759 if (!wp->w_arg_idx_invalid)
750 edited_win = wp; 760 edited_win = wp;
751 break; 761 break;
752 } 762 }
753 } 763 }
754 764
755 // If no file got edited create an empty tab page. 765 // If no file got edited create an empty tab page.
756 if (need_tabnext && put_line(fd, "tabnext") == FAIL) 766 if (need_tabnext && put_line(fd, "tabnext") == FAIL)
757 return FAIL; 767 goto fail;
758 768
759 // Save current window layout. 769 // Save current window layout.
760 if (put_line(fd, "set splitbelow splitright") == FAIL) 770 if (put_line(fd, "set splitbelow splitright") == FAIL)
761 return FAIL; 771 goto fail;
762 if (ses_win_rec(fd, tab_topframe) == FAIL) 772 if (ses_win_rec(fd, tab_topframe) == FAIL)
763 return FAIL; 773 goto fail;
764 if (!p_sb && put_line(fd, "set nosplitbelow") == FAIL) 774 if (!p_sb && put_line(fd, "set nosplitbelow") == FAIL)
765 return FAIL; 775 goto fail;
766 if (!p_spr && put_line(fd, "set nosplitright") == FAIL) 776 if (!p_spr && put_line(fd, "set nosplitright") == FAIL)
767 return FAIL; 777 goto fail;
768 778
769 // Check if window sizes can be restored (no windows omitted). 779 // Check if window sizes can be restored (no windows omitted).
770 // Remember the window number of the current window after restoring. 780 // Remember the window number of the current window after restoring.
771 nr = 0; 781 nr = 0;
772 for (wp = tab_firstwin; wp != NULL; wp = W_NEXT(wp)) 782 for (wp = tab_firstwin; wp != NULL; wp = W_NEXT(wp))
779 cnr = nr; 789 cnr = nr;
780 } 790 }
781 791
782 // Go to the first window. 792 // Go to the first window.
783 if (put_line(fd, "wincmd t") == FAIL) 793 if (put_line(fd, "wincmd t") == FAIL)
784 return FAIL; 794 goto fail;
785 795
786 // If more than one window, see if sizes can be restored. 796 // If more than one window, see if sizes can be restored.
787 // First set 'winheight' and 'winwidth' to 1 to avoid the windows being 797 // First set 'winheight' and 'winwidth' to 1 to avoid the windows being
788 // resized when moving between windows. 798 // resized when moving between windows.
789 // Do this before restoring the view, so that the topline and the 799 // Do this before restoring the view, so that the topline and the
792 // user has set winheight or winwidth. 802 // user has set winheight or winwidth.
793 if (put_line(fd, "set winminheight=0") == FAIL 803 if (put_line(fd, "set winminheight=0") == FAIL
794 || put_line(fd, "set winheight=1") == FAIL 804 || put_line(fd, "set winheight=1") == FAIL
795 || put_line(fd, "set winminwidth=0") == FAIL 805 || put_line(fd, "set winminwidth=0") == FAIL
796 || put_line(fd, "set winwidth=1") == FAIL) 806 || put_line(fd, "set winwidth=1") == FAIL)
797 return FAIL; 807 goto fail;
798 if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL) 808 if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
799 return FAIL; 809 goto fail;
800 810
801 // Restore the tab-local working directory if specified 811 // Restore the tab-local working directory if specified
802 // Do this before the windows, so that the window-local directory can 812 // Do this before the windows, so that the window-local directory can
803 // override the tab-local directory. 813 // override the tab-local directory.
804 if (tp != NULL && tp->tp_localdir != NULL && ssop_flags & SSOP_CURDIR) 814 if (tp != NULL && tp->tp_localdir != NULL && ssop_flags & SSOP_CURDIR)
805 { 815 {
806 if (fputs("tcd ", fd) < 0 816 if (fputs("tcd ", fd) < 0
807 || ses_put_fname(fd, tp->tp_localdir, &ssop_flags) == FAIL 817 || ses_put_fname(fd, tp->tp_localdir, &ssop_flags) == FAIL
808 || put_eol(fd) == FAIL) 818 || put_eol(fd) == FAIL)
809 return FAIL; 819 goto fail;
810 did_lcd = TRUE; 820 did_lcd = TRUE;
811 } 821 }
812 822
813 // Restore the view of the window (options, file, cursor, etc.). 823 // Restore the view of the window (options, file, cursor, etc.).
814 for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) 824 for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
815 { 825 {
816 if (!ses_do_win(wp)) 826 if (!ses_do_win(wp))
817 continue; 827 continue;
818 if (put_view(fd, wp, wp != edited_win, &ssop_flags, 828 if (put_view(fd, wp, wp != edited_win, &ssop_flags, cur_arg_idx
819 cur_arg_idx) == FAIL) 829 #ifdef FEAT_TERMINAL
820 return FAIL; 830 , &terminal_bufs
831 #endif
832 ) == FAIL)
833 goto fail;
821 if (nr > 1 && put_line(fd, "wincmd w") == FAIL) 834 if (nr > 1 && put_line(fd, "wincmd w") == FAIL)
822 return FAIL; 835 goto fail;
823 next_arg_idx = wp->w_arg_idx; 836 next_arg_idx = wp->w_arg_idx;
824 } 837 }
825 838
826 // The argument index in the first tab page is zero, need to set it in 839 // The argument index in the first tab page is zero, need to set it in
827 // each window. For further tab pages it's the window where we do 840 // each window. For further tab pages it's the window where we do
829 cur_arg_idx = next_arg_idx; 842 cur_arg_idx = next_arg_idx;
830 843
831 // Restore cursor to the current window if it's not the first one. 844 // Restore cursor to the current window if it's not the first one.
832 if (cnr > 1 && (fprintf(fd, "%dwincmd w", cnr) < 0 845 if (cnr > 1 && (fprintf(fd, "%dwincmd w", cnr) < 0
833 || put_eol(fd) == FAIL)) 846 || put_eol(fd) == FAIL))
834 return FAIL; 847 goto fail;
835 848
836 // Restore window sizes again after jumping around in windows, because 849 // Restore window sizes again after jumping around in windows, because
837 // the current window has a minimum size while others may not. 850 // the current window has a minimum size while others may not.
838 if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL) 851 if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
839 return FAIL; 852 goto fail;
840 853
841 // Don't continue in another tab page when doing only the current one 854 // Don't continue in another tab page when doing only the current one
842 // or when at the last tab page. 855 // or when at the last tab page.
843 if (!(ssop_flags & SSOP_TABPAGES)) 856 if (!(ssop_flags & SSOP_TABPAGES))
844 break; 857 break;
846 859
847 if (ssop_flags & SSOP_TABPAGES) 860 if (ssop_flags & SSOP_TABPAGES)
848 { 861 {
849 if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0 862 if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
850 || put_eol(fd) == FAIL) 863 || put_eol(fd) == FAIL)
851 return FAIL; 864 goto fail;
852 } 865 }
853 if (restore_stal && put_line(fd, "set stal=1") == FAIL) 866 if (restore_stal && put_line(fd, "set stal=1") == FAIL)
854 return FAIL; 867 goto fail;
855 868
856 // Now put the remaining buffers into the buffer list. 869 // Now put the remaining buffers into the buffer list.
857 // This is near the end, so that when 'hidden' is set we don't create extra 870 // This is near the end, so that when 'hidden' is set we don't create extra
858 // buffers. If the buffer was already created with another command the 871 // buffers. If the buffer was already created with another command the
859 // ":badd" will have no effect. 872 // ":badd" will have no effect.
870 && buf->b_p_bl) 883 && buf->b_p_bl)
871 { 884 {
872 if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L 885 if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L
873 : buf->b_wininfo->wi_fpos.lnum) < 0 886 : buf->b_wininfo->wi_fpos.lnum) < 0
874 || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL) 887 || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL)
875 return FAIL; 888 goto fail;
876 } 889 }
877 } 890 }
878 891
879 // Wipe out an empty unnamed buffer we started in. 892 // Wipe out an empty unnamed buffer we started in.
880 if (put_line(fd, "if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0") 893 if (put_line(fd, "if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0")
881 == FAIL) 894 == FAIL)
882 return FAIL; 895 goto fail;
883 if (put_line(fd, " silent exe 'bwipe ' . s:wipebuf") == FAIL) 896 if (put_line(fd, " silent exe 'bwipe ' . s:wipebuf") == FAIL)
884 return FAIL; 897 goto fail;
885 if (put_line(fd, "endif") == FAIL) 898 if (put_line(fd, "endif") == FAIL)
886 return FAIL; 899 goto fail;
887 if (put_line(fd, "unlet! s:wipebuf") == FAIL) 900 if (put_line(fd, "unlet! s:wipebuf") == FAIL)
888 return FAIL; 901 goto fail;
889 902
890 // Re-apply 'winheight', 'winwidth' and 'shortmess'. 903 // Re-apply 'winheight', 'winwidth' and 'shortmess'.
891 if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s", 904 if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s",
892 p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL) 905 p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL)
893 return FAIL; 906 goto fail;
894 // Re-apply 'winminheight' and 'winminwidth'. 907 // Re-apply 'winminheight' and 'winminwidth'.
895 if (fprintf(fd, "set winminheight=%ld winminwidth=%ld", 908 if (fprintf(fd, "set winminheight=%ld winminwidth=%ld",
896 p_wmh, p_wmw) < 0 || put_eol(fd) == FAIL) 909 p_wmh, p_wmw) < 0 || put_eol(fd) == FAIL)
897 return FAIL; 910 goto fail;
898 911
899 // Lastly, execute the x.vim file if it exists. 912 // Lastly, execute the x.vim file if it exists.
900 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL 913 if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
901 || put_line(fd, "if filereadable(s:sx)") == FAIL 914 || put_line(fd, "if filereadable(s:sx)") == FAIL
902 || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL 915 || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
903 || put_line(fd, "endif") == FAIL) 916 || put_line(fd, "endif") == FAIL)
904 return FAIL; 917 goto fail;
905 918
906 return OK; 919 ret = OK;
920 fail:
921 #ifdef FEAT_TERMINAL
922 hash_clear_all(&terminal_bufs, 0);
923 #endif
924 return ret;
907 } 925 }
908 926
909 /* 927 /*
910 * Get the name of the view file for the current buffer. 928 * Get the name of the view file for the current buffer.
911 */ 929 */
1081 #ifdef FEAT_SESSION 1099 #ifdef FEAT_SESSION
1082 int view_session = FALSE; 1100 int view_session = FALSE;
1083 int using_vdir = FALSE; // using 'viewdir'? 1101 int using_vdir = FALSE; // using 'viewdir'?
1084 char_u *viewFile = NULL; 1102 char_u *viewFile = NULL;
1085 unsigned *flagp; 1103 unsigned *flagp;
1104 #endif
1105 #ifdef FEAT_TERMINAL
1106 hashtab_T terminal_bufs;
1107
1108 hash_init(&terminal_bufs);
1086 #endif 1109 #endif
1087 1110
1088 if (eap->cmdidx == CMD_mksession || eap->cmdidx == CMD_mkview) 1111 if (eap->cmdidx == CMD_mksession || eap->cmdidx == CMD_mkview)
1089 { 1112 {
1090 #ifdef FEAT_SESSION 1113 #ifdef FEAT_SESSION
1238 vim_free(dirnow); 1261 vim_free(dirnow);
1239 } 1262 }
1240 } 1263 }
1241 else 1264 else
1242 { 1265 {
1243 failed |= (put_view(fd, curwin, !using_vdir, flagp, 1266 failed |= (put_view(fd, curwin, !using_vdir, flagp, -1
1244 -1) == FAIL); 1267 #ifdef FEAT_TERMINAL
1268 , &terminal_bufs
1269 #endif
1270 ) == FAIL);
1245 } 1271 }
1246 if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save") 1272 if (put_line(fd, "let &so = s:so_save | let &siso = s:siso_save")
1247 == FAIL) 1273 == FAIL)
1248 failed = TRUE; 1274 failed = TRUE;
1249 #ifdef FEAT_SEARCH_EXTRA 1275 #ifdef FEAT_SEARCH_EXTRA