Skip to content

Commit

Permalink
[BUGFIX] Shows error for empty filenames (vim-startify)
Browse files Browse the repository at this point in the history
There was a fix in preservim#1043 which improves the behavior for non saved
filenames. Those are not on disk, but also not empty. This lead to an
issue preservim#1059 where actual "empty files" like created with vim-startify or
stdin lead to an error. This change fixes this by adapting the order of
the tests. It'll print "no file for the current buffer" for empty files.

Solves preservim#1059
  • Loading branch information
andys8 committed Jan 19, 2020
1 parent 26740d1 commit 2b38bd8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions autoload/nerdtree/ui_glue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,16 @@ endfunction
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr) abort
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h')
endif

if empty(l:pathStr)
call nerdtree#echoWarning('no file for the current buffer')
return
endif

if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h')
endif

try
let l:pathStr = g:NERDTreePath.Resolve(l:pathStr)
let l:pathObj = g:NERDTreePath.New(l:pathStr)
Expand Down

0 comments on commit 2b38bd8

Please sign in to comment.