buffer: don't rely on curbuf in BUFEMPTY

This commit is contained in:
Thomas Vigouroux
2020-09-16 22:57:34 +02:00
parent df33f30e88
commit 55a2c513aa
13 changed files with 18 additions and 20 deletions

View File

@@ -1444,11 +1444,9 @@ static void read_stdin(void)
no_wait_return = true;
int save_msg_didany = msg_didany;
set_buflisted(true);
// Create memfile and read from stdin.
(void)open_buffer(true, NULL, 0);
if (BUFEMPTY() && curbuf->b_next != NULL) {
if (BUFEMPTY(curbuf) && 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.