diff src/session.c @ 28238:800e7de2f96d v8.2.4645

patch 8.2.4645: 'shortmess' changed when session does not store options Commit: https://github.com/vim/vim/commit/fd01280d01c2270a320d8c962d24140a8176a400 Author: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Tue Mar 29 12:02:57 2022 +0100 patch 8.2.4645: 'shortmess' changed when session does not store options Problem: 'shortmess' changed when session does not store options. Solution: Save and restore 'shortmess' if needed. (James Charti, closes #10037)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Mar 2022 13:15:03 +0200
parents f1c00b8085f6
children 27dcbe70e1f0
line wrap: on
line diff
--- a/src/session.c
+++ b/src/session.c
@@ -686,6 +686,11 @@ makeopens(
     if (put_line(fd, "endif") == FAIL)
 	goto fail;
 
+    // save 'shortmess' if not storing options
+    if ((ssop_flags & SSOP_OPTIONS) == 0
+	    && put_line(fd, "let s:shortmess_save = &shortmess") == FAIL)
+	goto fail;
+
     // Now save the current files, current buffer first.
     if (put_line(fd, "set shortmess=aoO") == FAIL)
 	goto fail;
@@ -956,10 +961,23 @@ makeopens(
     if (put_line(fd, "unlet! s:wipebuf") == FAIL)
 	goto fail;
 
-    // Re-apply 'winheight', 'winwidth' and 'shortmess'.
-    if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s",
-			       p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL)
+    // Re-apply 'winheight' and 'winwidth'.
+    if (fprintf(fd, "set winheight=%ld winwidth=%ld",
+			       p_wh, p_wiw) < 0 || put_eol(fd) == FAIL)
 	goto fail;
+
+    // Restore 'shortmess'.
+    if (ssop_flags & SSOP_OPTIONS)
+    {
+        if (fprintf(fd, "set shortmess=%s", p_shm) < 0 || put_eol(fd) == FAIL)
+            goto fail;
+    }
+    else
+    {
+        if (put_line(fd, "let &shortmess = s:shortmess_save") == FAIL)
+            goto fail;
+    }
+
     if (tab_firstwin->w_next != NULL)
     {
 	// Restore 'winminheight' and 'winminwidth'.