Просмотр исходного кода

Consolidate `bufExplorerShowXxx` logic into `s:BuildBufferList()`.

Michael Henry 10 месяцев назад
Родитель
Сommit
04ed6672ae
1 измененных файлов с 10 добавлено и 9 удалено
  1. 10 9
      plugin/bufexplorer.vim

+ 10 - 9
plugin/bufexplorer.vim

@@ -710,20 +710,11 @@ function! s:GetBufferInfo(bufnr)
         endif
 
         let b.isterminal = getbufvar(b._bufnr, '&buftype') == 'terminal'
-        " Filter out term:// buffers if g:bufExplorerShowTerminal is 0.
-        if !g:bufExplorerShowTerminal && b.isterminal
-            continue
-        endif
-
         for [key, val] in items(s:types)
             let b[key] = fnamemodify(name, val)
         endfor
 
         let b.isdir = getftype(b.fullname) == "dir"
-        if !g:bufExplorerShowDirectories && b.isdir
-            continue
-        endif
-
         if b.isdir
             let b.shortname = "<DIRECTORY>"
         endif
@@ -771,6 +762,16 @@ function! s:BuildBufferList()
             continue
         endif
 
+        " Skip terminal buffers if we are not to show them.
+        if !g:bufExplorerShowTerminal && buf.isterminal
+            continue
+        endif
+
+        " Skip directory buffers if we are not to show them.
+        if !g:bufExplorerShowDirectories && buf.isdir
+            continue
+        endif
+
         let line = buf.attributes." "
 
         if exists("g:loaded_webdevicons")