patch 9.2.0592: Error when restoring session with terminal window

Commit: 
https://github.com/vim/vim/commit/b42e8057332a852e1c5359e557289a13f85855d8
Author: Foxe Chen <[email protected]>
Date:   Wed Jun 3 18:57:17 2026 +0000

    patch 9.2.0592: Error when restoring session with terminal window
    
    Problem:  Error when restoring session with terminal window
              (after v9.2.0579)
    Solution: Convert to proper Vim9 script (Foxe Chen)
    
    closes: #20416
    
    Signed-off-by: Foxe Chen <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/terminal.c b/src/terminal.c
index b748ed35f..a22047506 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1107,7 +1107,7 @@ term_write_session(FILE *fd, win_T *wp, hashtab_T 
*terminal_bufs)
        if (!HASHITEM_EMPTY(entry))
        {
            // we've already opened this terminal buffer
-           if (fprintf(fd, "execute 'buffer ' . s:term_buf_%d", bufnr) < 0)
+           if (fprintf(fd, "execute 'buffer ' . term_buf_%d", bufnr) < 0)
                return FAIL;
            return put_eol(fd);
        }
@@ -1128,7 +1128,7 @@ term_write_session(FILE *fd, win_T *wp, hashtab_T 
*terminal_bufs)
     if (put_eol(fd) != OK)
        return FAIL;
 
-    if (fprintf(fd, "let s:term_buf_%d = bufnr()", bufnr) < 0)
+    if (fprintf(fd, "var term_buf_%d: number = bufnr()", bufnr) < 0)
        return FAIL;
 
     if (terminal_bufs != NULL && wp->w_buffer->b_nwindows > 1)
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index 9bf1b47ff..4dec8815a 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -581,17 +581,20 @@ func Test_mksession_terminal_shared_windows()
   let lines = readfile('Xtest_mks.out')
   let found_creation = 0
   let found_use = 0
+  let found_var = 0
 
   for line in lines
     if line =~ '^terminal'
       let found_creation = 1
       call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+', line)
-    elseif line =~ "^execute 'buffer ' . s:term_buf_" . term_buf . "$"
+    elseif line =~ $"^var term_buf_{term_buf}: number = bufnr()$"
+      let found_var = 1
+    elseif line =~ "^execute 'buffer ' . term_buf_" . term_buf . "$"
       let found_use = 1
     endif
   endfor
 
-  call assert_true(found_creation && found_use)
+  call assert_true(found_creation && found_use && found_var)
 
   call StopShellInTerminal(term_buf)
   call delete('Xtest_mks.out')
diff --git a/src/version.c b/src/version.c
index e2999b0b2..250b63815 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    592,
 /**/
     591,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wUr3P-003tAn-S6%40256bit.org.

Raspunde prin e-mail lui