diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-08 20:58:36 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-08 20:58:36 -0700 |
commit | 9e0ce1a158417e34a0b4b6690e1f6a1816c6e725 (patch) | |
tree | d90480e50c33933450009f17f6b5b4641838ebfc | |
parent | 74c362cec029ba39a8eb0bbd629148e4b6b54968 (diff) | |
parent | 8dde9b58e56345c8c04620d513b55d3b518ea98e (diff) | |
download | rneovim-9e0ce1a158417e34a0b4b6690e1f6a1816c6e725.tar.gz rneovim-9e0ce1a158417e34a0b4b6690e1f6a1816c6e725.tar.bz2 rneovim-9e0ce1a158417e34a0b4b6690e1f6a1816c6e725.zip |
Merge #10973 'vim-patch:8.1.1197'
-rw-r--r-- | src/nvim/main.c | 16 | ||||
-rw-r--r-- | src/nvim/testdir/test_startup.vim | 13 | ||||
-rw-r--r-- | test/functional/core/startup_spec.lua | 18 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 4335dab1f9..bca8991b0f 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1535,6 +1535,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd) int i; bool advance = true; win_T *win; + char *p_shm_save = NULL; /* * Don't execute Win/Buf Enter/Leave autocommands here @@ -1566,6 +1567,16 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd) 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 = xstrdup((char *)p_shm); + snprintf(buf, sizeof(buf), "F%s", p_shm); + set_option_value("shm", 0L, buf, 0); + } } else { if (curwin->w_next == NULL) /* just checking */ break; @@ -1606,6 +1617,11 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd) } } + if (p_shm_save != NULL) { + set_option_value("shm", 0L, p_shm_save, 0); + xfree(p_shm_save); + } + if (parmp->window_layout == WIN_TABS) goto_tabpage(1); --autocmd_no_enter; diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index b5647b610d..1e70f28a00 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -1,6 +1,7 @@ " Tests for startup. source shared.vim +source screendump.vim " Check that loading startup.vim works. func Test_startup_script() @@ -559,3 +560,15 @@ func Test_zzz_startinsert() endif call delete('Xtestout') 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 diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 3b32c42ec0..2d6eb4dd45 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -251,6 +251,24 @@ describe('startup', function() | ]]) end) + + it("sets 'shortmess' when loading other tabs", function() + clear({args={'-p', 'a', 'b', 'c'}}) + local screen = Screen.new(25, 4) + screen:attach() + screen:expect({grid=[[ + {1: a }{2: b c }{3: }{2:X}| + ^ | + {4:~ }| + | + ]], + attr_ids={ + [1] = {bold = true}, + [2] = {background = Screen.colors.LightGrey, underline = true}, + [3] = {reverse = true}, + [4] = {bold = true, foreground = Screen.colors.Blue1}, + }}) + end) end) describe('sysinit', function() |