patch 8.1.0110: file name not displayed with ":file" v8.1.0110
authorBram Moolenaar <Bram@vim.org>
Sun, 24 Jun 2018 14:53:35 +0000 (16:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 24 Jun 2018 14:53:35 +0000 (16:53 +0200)
Problem:    File name not displayed with ":file" when 'F' is in 'shortmess'.
Solution:   Always display the file name when there is no argument (Christian
            Brabandt, closes #3070)

src/ex_cmds.c
src/testdir/test_options.vim
src/version.c

index 53334342c1571c83e981ca650f487ae71cf8071d..2ed2bdb4d31b65ba5f72893e8509fda76ab724a0 100644 (file)
@@ -3094,11 +3094,12 @@ ex_file(exarg_T *eap)
     {
        if (rename_buffer(eap->arg) == FAIL)
            return;
+       redraw_tabline = TRUE;
     }
-    /* print full file name if :cd used */
-    if (!shortmess(SHM_FILEINFO))
+
+    // print file name if no argument or 'F' is not in 'shortmess'
+    if (*eap->arg == NUL || !shortmess(SHM_FILEINFO))
        fileinfo(FALSE, FALSE, eap->forceit);
-    redraw_tabline = TRUE;
 }
 
 /*
index 167cb1ce069b3d9db41cec4572e00d9f3942605f..460a569f5148b97fe709ed36a985793c9124c961 100644 (file)
@@ -400,3 +400,17 @@ func Test_copy_winopt()
     call assert_equal(4,&numberwidth)
     bw!
 endfunc
+
+func Test_shortmess_F()
+  new
+  call assert_match('\[No Name\]', execute('file'))
+  set shortmess+=F
+  call assert_match('\[No Name\]', execute('file'))
+  call assert_match('^\s*$', execute('file foo'))
+  call assert_match('foo', execute('file'))
+  set shortmess-=F
+  call assert_match('bar', execute('file bar'))
+  call assert_match('bar', execute('file'))
+  set shortmess&
+  bwipe
+endfunc
index 00f3c0df690684ea6734e82e52df96377e7ba0ea..b539e9eb2c988d1bffda6b480eafc255628a4cdd 100644 (file)
@@ -789,6 +789,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    110,
 /**/
     109,
 /**/