diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2017-01-09 12:53:06 +0100 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-02-04 17:55:45 -0500 |
commit | e3b92c77da0277c8d58e037e42c5b929be469284 (patch) | |
tree | bc8bb9e5a7f57d8abf494cd096976ed370dc7ffe /src/nvim/buffer.c | |
parent | d60d1b3232a43cbc025dbbec91535260d493d89e (diff) | |
download | rneovim-e3b92c77da0277c8d58e037e42c5b929be469284.tar.gz rneovim-e3b92c77da0277c8d58e037e42c5b929be469284.tar.bz2 rneovim-e3b92c77da0277c8d58e037e42c5b929be469284.zip |
vim-patch:7.4.2023
Problem: buflist_findname_stat() may find a dummy buffer.
Solution: Set the BF_DUMMY flag after loading a dummy buffer. Start
finding buffers from the end of the list.
NOTE: In Neovim, buflist_findname_stat() was replaced by
buflist_findname_file_id() in c41535d69.
https://github.com/vim/vim/commit/ea3f2e7be447a8f0c4436869620f908de5e8ef1e
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 81dceacd37..9204357fee 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1849,7 +1849,8 @@ buf_T *buflist_findname(char_u *ffname) static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id, bool file_id_valid) { - FOR_ALL_BUFFERS(buf) { + // Start at the last buffer, expect to find a match sooner. + FOR_ALL_BUFFERS_BACKWARDS(buf) { if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname, file_id, file_id_valid)) { return buf; @@ -1923,7 +1924,7 @@ int buflist_findpat( return -1; } - FOR_ALL_BUFFERS(buf) { + FOR_ALL_BUFFERS_BACKWARDS(buf) { if (buf->b_p_bl == find_listed && (!diffmode || diff_mode_buf(buf)) && buflist_match(®match, buf, false) != NULL) { |