]> granicus.if.org Git - vim/commitdiff
patch 8.1.1334: when buffer is hidden "F" in 'shortmess' is not used v8.1.1334
authorBram Moolenaar <Bram@vim.org>
Thu, 16 May 2019 18:29:44 +0000 (20:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 16 May 2019 18:29:44 +0000 (20:29 +0200)
Problem:    When buffer is hidden "F" in 'shortmess' is not used.
Solution:   Check the "F" flag in 'shortmess' when the buffer is already
            loaded. (Jason Franklin)  Add test_getvalue() to be able to test
            this.

runtime/doc/eval.txt
src/buffer.c
src/evalfunc.c
src/testdir/test_options.vim
src/version.c

index eb7a8211faa8170522a6ca8bf8fefcd4e8e918cc..e43f57bc0c12b04cf5f8b19ad4536ab319205868 100644 (file)
@@ -2701,6 +2701,7 @@ test_alloc_fail({id}, {countdown}, {repeat})
 test_autochdir()               none    enable 'autochdir' during startup
 test_feedinput({string})       none    add key sequence to input buffer
 test_garbagecollect_now()      none    free memory right now for testing
+test_getvalue({string})                any     get value of an internal variable
 test_ignore_error({expr})      none    ignore a specific error
 test_null_blob()               Blob    null value for testing
 test_null_channel()            Channel null value for testing
@@ -9894,6 +9895,11 @@ test_garbagecollect_now()                         *test_garbagecollect_now()*
                internally, and |v:testing| must have been set before calling
                any function.
 
+test_getvalue({name})                                  *test_getvalue()*
+               Get the value of an internal variable.  These values for
+               {name} are supported:
+                       need_fileinfo
+
 test_ignore_error({expr})                       *test_ignore_error()*
                Ignore any error containing {expr}.  A normal message is given
                instead.
index e825a99a42b12766685730675204584777e059c1..e10368483db7195924eee686b8ed3380356de51b 100644 (file)
@@ -1742,9 +1742,12 @@ enter_buffer(buf_T *buf)
     }
     else
     {
-       if (!msg_silent)
-           need_fileinfo = TRUE;       /* display file info after redraw */
-       (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */
+       if (!msg_silent && !shortmess(SHM_FILEINFO))
+           need_fileinfo = TRUE;       // display file info after redraw
+
+       // check if file changed
+       (void)buf_check_timestamp(curbuf, FALSE);
+
        curwin->w_topline = 1;
 #ifdef FEAT_DIFF
        curwin->w_topfill = 0;
index 0dbd6514ecae4d9df9f8835b1eca78d21cf07825..b5a6d685c6cec7a6c8e5e4131f42c999a6578255 100644 (file)
@@ -442,6 +442,7 @@ static void f_tempname(typval_T *argvars, typval_T *rettv);
 static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
 static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
 static void f_test_feedinput(typval_T *argvars, typval_T *rettv);
+static void f_test_getvalue(typval_T *argvars, typval_T *rettv);
 static void f_test_option_not_set(typval_T *argvars, typval_T *rettv);
 static void f_test_override(typval_T *argvars, typval_T *rettv);
 static void f_test_refcount(typval_T *argvars, typval_T *rettv);
@@ -991,6 +992,7 @@ static struct fst
     {"test_autochdir", 0, 0, f_test_autochdir},
     {"test_feedinput", 1, 1, f_test_feedinput},
     {"test_garbagecollect_now",        0, 0, f_test_garbagecollect_now},
+    {"test_getvalue",  1, 1, f_test_getvalue},
     {"test_ignore_error",      1, 1, f_test_ignore_error},
     {"test_null_blob", 0, 0, f_test_null_blob},
 #ifdef FEAT_JOB_CHANNEL
@@ -14412,6 +14414,25 @@ f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
 #endif
 }
 
+/*
+ * "test_getvalue({name})" function
+ */
+    static void
+f_test_getvalue(typval_T *argvars, typval_T *rettv)
+{
+    if (argvars[0].v_type != VAR_STRING)
+       emsg(_(e_invarg));
+    else
+    {
+       char_u *name = tv_get_string(&argvars[0]);
+
+       if (STRCMP(name, (char_u *)"need_fileinfo") == 0)
+           rettv->vval.v_number = need_fileinfo;
+       else
+           semsg(_(e_invarg2), name);
+    }
+}
+
 /*
  * "test_option_not_set({name})" function
  */
index 6cc0c1a1801d5ace53d40cdec18b766a54dbdccd..c5dbb9f4c47b7b6081a295d64950ca7359b01eb4 100644 (file)
@@ -470,13 +470,19 @@ func Test_shortmess_F2()
   call assert_match('file2', execute('bn', ''))
   set shortmess+=F
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   set hidden
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   set nohidden
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   call assert_true(empty(execute('bn', '')))
+  call assert_false(test_getvalue('need_fileinfo'))
   set shortmess&
   call assert_match('file1', execute('bn', ''))
   call assert_match('file2', execute('bn', ''))
index 3a6c0c0080ab9a70ed37ad813599f4bd679d2b01..ad16cd5706aa2ab4abbbcbb3b38ac370cbbc3493 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1334,
 /**/
     1333,
 /**/