]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0158: 'shortmess' "F" flag doesn't work properly with 'autoread' v9.1.0158
authorzeertzjq <zeertzjq@outlook.com>
Thu, 7 Mar 2024 20:48:33 +0000 (21:48 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 7 Mar 2024 20:48:33 +0000 (21:48 +0100)
Problem:  'shortmess' "F" flag doesn't work properly with 'autoread'
          (after 9.1.0154)
Solution: Hide the file info message instead of the warning dialog
          (zeertzjq)

closes: #14159
closes: #14158

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fileio.c
src/testdir/test_options.vim
src/version.c

index 344c819e7e89c952abf921267a9557c1b875471c..ad09c5a225dc8a9e8a4f6b87022a8d547c99fbdb 100644 (file)
@@ -4294,7 +4294,7 @@ buf_check_timestamp(
 #endif
     }
 
-    if (mesg != NULL && !shortmess(SHM_FILEINFO))
+    if (mesg != NULL)
     {
        path = home_replace_save(buf, buf->b_fname);
        if (path != NULL)
@@ -4489,8 +4489,14 @@ buf_reload(buf_T *buf, int orig_mode, int reload_options)
 
        if (saved == OK)
        {
+           int old_msg_silent = msg_silent;
+
            curbuf->b_flags |= BF_CHECK_RO;     // check for RO again
            keep_filetype = TRUE;               // don't detect 'filetype'
+
+           if (shortmess(SHM_FILEINFO))
+               msg_silent = 1;
+
            if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0,
                        (linenr_T)0,
                        (linenr_T)MAXLNUM, &ea, flags) != OK)
@@ -4521,6 +4527,8 @@ buf_reload(buf_T *buf, int orig_mode, int reload_options)
                    u_unchanged(curbuf);
                }
            }
+
+           msg_silent = old_msg_silent;
        }
        vim_free(ea.cmd);
 
index fa65f5c192e9f312690a2bdc206449c2e7574f64..fbfbaae14c4245ef24292b5cab6c8c73d6f832c7 100644 (file)
@@ -1294,23 +1294,41 @@ func Test_shortmess_F2()
 endfunc
 
 func Test_shortmess_F3()
-  defer delete('X_dummy')
+  call writefile(['foo'], 'X_dummy', 'D')
 
   set hidden
   set autoread
   e X_dummy
-  e file
-
+  e Xotherfile
+  call assert_equal(['foo'], getbufline('X_dummy', 1, '$'))
   set shortmess+=F
-  call writefile(["foo"], 'X_dummy')
-  call assert_true(empty(execute('bn', '')))
-  call assert_true(empty(execute('bn', '')))
+  echo ''
+
+  if has('nanotime')
+    sleep 10m
+  else
+    sleep 2
+  endif
+  call writefile(['bar'], 'X_dummy')
+  bprev
+  call assert_equal('', Screenline(&lines))
+  call assert_equal(['bar'], getbufline('X_dummy', 1, '$'))
+
+  if has('nanotime')
+    sleep 10m
+  else
+    sleep 2
+  endif
+  call writefile(['baz'], 'X_dummy')
+  checktime
+  call assert_equal('', Screenline(&lines))
+  call assert_equal(['baz'], getbufline('X_dummy', 1, '$'))
 
   set shortmess&
   set autoread&
   set hidden&
-  bwipe
-  bwipe
+  bwipe X_dummy
+  bwipe Xotherfile
 endfunc
 
 func Test_local_scrolloff()
index 86537c4377ad570030d3c1ab0ee8bc2b30b36fc9..8a1bb161c0ff4f43af148050ae403c9765cd67ac 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    158,
 /**/
     157,
 /**/