mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
Merge #8576 from justinmk/startup-empty-stdin
This commit is contained in:
commit
74d19f685f
@ -1410,6 +1410,12 @@ static void read_stdin(void)
|
||||
int save_msg_didany = msg_didany;
|
||||
set_buflisted(true);
|
||||
(void)open_buffer(true, NULL, 0); // create memfile and read file
|
||||
if (BUFEMPTY() && curbuf->b_next != NULL) {
|
||||
// stdin was empty, go to buffer 2 (e.g. "echo file1 | xargs nvim"). #8561
|
||||
do_cmdline_cmd("silent! bnext");
|
||||
// Delete the empty stdin buffer.
|
||||
do_cmdline_cmd("bwipeout 1");
|
||||
}
|
||||
no_wait_return = false;
|
||||
msg_didany = save_msg_didany;
|
||||
TIME_MSG("reading stdin");
|
||||
|
@ -122,6 +122,18 @@ describe('startup', function()
|
||||
{ 'ohyeah', '' }))
|
||||
end)
|
||||
|
||||
it('if stdin is empty: selects buffer 2, deletes buffer 1 #8561', function()
|
||||
eq('\r\n 2 %a "file1" line 0\r\n 3 "file2" line 0',
|
||||
funcs.system({nvim_prog, '-n', '-u', 'NONE', '-i', 'NONE', '--headless',
|
||||
'+ls!',
|
||||
'+qall!',
|
||||
'-',
|
||||
'file1',
|
||||
'file2',
|
||||
},
|
||||
{ '' }))
|
||||
end)
|
||||
|
||||
it('-e/-E interactive #7679', function()
|
||||
clear('-e')
|
||||
local screen = Screen.new(25, 3)
|
||||
|
Loading…
Reference in New Issue
Block a user