diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:59:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-11 19:59:37 +0100 |
commit | f389196a344591da2f6cc2a63f4953e34316f954 (patch) | |
tree | 8cce092c29f33ae109dcf61e12e822d84aa014c7 /src/nvim/quickfix.c | |
parent | 2cfc1b055bba6bb0f7e263a69079c7f52303a78a (diff) | |
parent | f26a4d484b486019c90fc55af5e74e33de374bc4 (diff) | |
download | rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.gz rneovim-f389196a344591da2f6cc2a63f4953e34316f954.tar.bz2 rneovim-f389196a344591da2f6cc2a63f4953e34316f954.zip |
Merge #7960 'vim patches'
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index ea2d13761c..1aeadcec4a 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3909,6 +3909,7 @@ load_dummy_buffer ( bufref_T newbuf_to_wipe; int failed = true; aco_save_T aco; + int readfile_result; // Allocate a buffer without putting it in the buffer list. newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); @@ -3922,7 +3923,9 @@ load_dummy_buffer ( /* need to open the memfile before putting the buffer in a window */ if (ml_open(newbuf) == OK) { - /* set curwin/curbuf to buf and save a few things */ + // Make sure this buffer isn't wiped out by auto commands. + newbuf->b_locked++; + // set curwin/curbuf to buf and save a few things aucmd_prepbuf(&aco, newbuf); /* Need to set the filename for autocommands. */ @@ -3936,9 +3939,11 @@ load_dummy_buffer ( curbuf->b_flags &= ~BF_DUMMY; newbuf_to_wipe.br_buf = NULL; - if (readfile(fname, NULL, - (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, - NULL, READ_NEW | READ_DUMMY) == OK + readfile_result = readfile(fname, NULL, (linenr_T)0, (linenr_T)0, + (linenr_T)MAXLNUM, NULL, + READ_NEW | READ_DUMMY); + newbuf->b_locked--; + if (readfile_result == OK && !got_int && !(curbuf->b_flags & BF_NEW)) { failed = FALSE; |