]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0310: file info msg not always suppressed with 'F' in 'shortmess' v8.1.0310
authorBram Moolenaar <Bram@vim.org>
Tue, 21 Aug 2018 16:50:18 +0000 (18:50 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 21 Aug 2018 16:50:18 +0000 (18:50 +0200)
Problem:    File info message not always suppressed with 'F' in 'shortmess'.
            (Asheq Imran)
Solution:   Save and restore msg_silent. (Christian Brabandt, closes #3221)

src/buffer.c
src/memline.c
src/testdir/test_options.vim
src/version.c

index 6bcd28b36c1283c09df993499dc64eb074c923d6..2ca131d23e11ee5fd19e4d3a40cc816128fca827 100644 (file)
@@ -1035,7 +1035,14 @@ handle_swap_exists(bufref_T *old_curbuf)
            buf = old_curbuf->br_buf;
        if (buf != NULL)
        {
+           int old_msg_silent = msg_silent;
+
+           if (shortmess(SHM_FILEINFO))
+               msg_silent = 1;  // prevent fileinfo message
            enter_buffer(buf);
+           // restore msg_silent, so that the command line will be shown
+           msg_silent = old_msg_silent;
+
 # ifdef FEAT_SYN_HL
            if (old_tw != curbuf->b_p_tw)
                check_colorcolumn(curwin);
index fb262acef55e328c9b5b066003e05c4379e485e6..fbdd8a372c0fe24319fbf2689116cb7ec994484d 100644 (file)
@@ -828,10 +828,13 @@ ml_open_file(buf_T *buf)
  */
     void
 check_need_swap(
-    int            newfile)            /* reading file into new buffer */
+    int            newfile)            // reading file into new buffer
 {
+    int old_msg_silent = msg_silent; // might be reset by an E325 message
+
     if (curbuf->b_may_swap && (!curbuf->b_p_ro || !newfile))
        ml_open_file(curbuf);
+    msg_silent = old_msg_silent;
 }
 
 /*
index d8f033e03f7bff8e743b44346fccff46c860014d..2d4a97aa18445b0936e5a296dc61724b6a0a8d03 100644 (file)
@@ -414,3 +414,24 @@ func Test_shortmess_F()
   set shortmess&
   bwipe
 endfunc
+
+func Test_shortmess_F2()
+  e file1
+  e file2
+  call assert_match('file1', execute('bn', ''))
+  call assert_match('file2', execute('bn', ''))
+  set shortmess+=F
+  call assert_true(empty(execute('bn', '')))
+  call assert_true(empty(execute('bn', '')))
+  set hidden
+  call assert_true(empty(execute('bn', '')))
+  call assert_true(empty(execute('bn', '')))
+  set nohidden
+  call assert_true(empty(execute('bn', '')))
+  call assert_true(empty(execute('bn', '')))
+  set shortmess&
+  call assert_match('file1', execute('bn', ''))
+  call assert_match('file2', execute('bn', ''))
+  bwipe
+  bwipe
+endfunc
index 8107b44c6e3c21387ef10109141dc832296e66a4..cc62660160299f0a16da33d004c4cbe257d34764 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    310,
 /**/
     309,
 /**/