]> granicus.if.org Git - vim/commitdiff
patch 8.1.1197: when starting with multiple tabs file messages is confusing v8.1.1197
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Apr 2019 13:55:10 +0000 (15:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Apr 2019 13:55:10 +0000 (15:55 +0200)
Problem:    When starting with multiple tabs file messages is confusing.
Solution:   Set 'shortmess' when loading the other tabs. (Christian Brabandt)

src/main.c
src/testdir/dumps/Test_start_with_tabs.dump [new file with mode: 0644]
src/testdir/test_startup.vim
src/version.c

index 5edcbdf8f69a48dc012629983f5d57fa05b9e0a0..0f26e984aa4423f4387eba4ca70f5fa6608b8fb2 100644 (file)
@@ -2777,6 +2777,7 @@ edit_buffers(
     int                i;
     int                advance = TRUE;
     win_T      *win;
+    char_u     *p_shm_save = NULL;
 
     /*
      * Don't execute Win/Buf Enter/Leave autocommands here
@@ -2812,6 +2813,17 @@ edit_buffers(
                if (curtab->tp_next == NULL)    /* just checking */
                    break;
                goto_tabpage(0);
+               // Temporarily reset 'shm' option to not print fileinfo when
+               // loading the other buffers. This would overwrite the already
+               // existing fileinfo for the first tab.
+               if (i == 1)
+               {
+                   char buf[100];
+
+                   p_shm_save = vim_strsave(p_shm);
+                   vim_snprintf(buf, 100, "F%s", p_shm);
+                   set_option_value((char_u *)"shm", 0L, (char_u *)buf, 0);
+               }
            }
            else
            {
@@ -2861,6 +2873,12 @@ edit_buffers(
        }
     }
 
+    if (p_shm_save != NULL)
+    {
+       set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
+       vim_free(p_shm_save);
+    }
+
     if (parmp->window_layout == WIN_TABS)
        goto_tabpage(1);
     --autocmd_no_enter;
diff --git a/src/testdir/dumps/Test_start_with_tabs.dump b/src/testdir/dumps/Test_start_with_tabs.dump
new file mode 100644 (file)
index 0000000..5490805
--- /dev/null
@@ -0,0 +1,20 @@
+| +2&#ffffff0|a| | +8#0000001#e0e0e08|b| @1|c| | +1#0000000#ffffff0@64|X+8#0000001#e0e0e08
+> +0#0000000#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|"+0#0000000&|a|"| |[|N|e|w| |F|i|l|e|]| @42|0|,|0|-|1| @8|A|l@1| 
index b7dd7eafdd2703cfb9526146a411dccd45575d2a..6509c0cc16473d16d129ef9cf085a1fa5006461b 100644 (file)
@@ -1,6 +1,7 @@
 " Tests for startup.
 
 source shared.vim
+source screendump.vim
 
 " Check that loading startup.vim works.
 func Test_startup_script()
@@ -547,3 +548,15 @@ func Test_issue_3969()
   let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
   call assert_equal('hello', out)
 endfunc
+
+func Test_start_with_tabs()
+  if !CanRunVimInTerminal()
+    return
+  endif
+
+  let buf = RunVimInTerminal('-p a b c', {})
+  call VerifyScreenDump(buf, 'Test_start_with_tabs', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+endfunc
index f9d474187ea9481bc623903a1f86e7a46519b6aa..234f4bf04d0d0f09d151949277d496650d1c8769 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1197,
 /**/
     1196,
 /**/