0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 9.1.1914: runtime(netrw): wipes unnamed buffers

Problem:  runtime(netrw): LocalBrowseCheck() wipes unnamed buffers when
          g:netrw_fastbrowse=0 (Carlos Falgueras García)
Solution: Check that bufname() is not empty

fixes: #18740
closes: #18741

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2025-11-13 21:11:51 +00:00
parent b8119920eb
commit 384685fade
3 changed files with 21 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
" 2025 Oct 26 by Vim Project fix parsing of remote user names #18611
" 2025 Oct 27 by Vim Project align comment after #18611
" 2025 Nov 01 by Vim Project fix NetrwChgPerm #18674
" 2025 Nov 13 by Vim Project don't wipe unnamed buffers #18740
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
@@ -8315,7 +8316,7 @@ function netrw#LocalBrowseCheck(dirname)
let ibuf = 1
let buflast = bufnr("$")
while ibuf <= buflast
if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf)))
if bufwinnr(ibuf) == -1 && !empty(bufname(ibuf)) && isdirectory(s:NetrwFile(bufname(ibuf)))
exe "sil! keepj keepalt ".ibuf."bw!"
endif
let ibuf= ibuf + 1