@@ -156,7 +156,7 @@ function! s:AddDiffDetails(hash, file)
156156 setlocal modifiable
157157 call append (0 , changes )
158158 normal ! gg
159- call project#HideNewlines ()
159+ call project#RemoveEmptyLines ()
160160 silent ! g /^new file mode/ d _
161161 if is_diff_line
162162 silent ! 1 ,3 d _
@@ -417,16 +417,16 @@ function! s:ShowDiffOnChangelist()
417417 endif
418418
419419 let file = s: GetCurrentFile ()
420+ if empty (file )
421+ call s: CloseBuffer (s: diff_buffer )
422+ return
423+ endif
420424 " Avoid E242
421425 try
422426 call s: OpenBuffer (s: diff_buffer , ' vertical' )
423427 call s: SetupDiffBuffer (s: GetAbsolutePath (file ))
424428 wincmd p
425429
426- if empty (file )
427- call s: CloseBuffer (s: diff_buffer )
428- return
429- endif
430430 call s: AddChangeDetails (file )
431431 catch
432432 call project#Warn (v: exception )
@@ -437,6 +437,8 @@ function! s:AddChangeDetails(file)
437437 let diff_file = s: TryGetDiffFile (a: file )
438438 if ! empty (diff_file)
439439 let cmd = ' cat ' .diff_file
440+ elseif isdirectory (s: GetAbsolutePath (a: file ))
441+ let cmd = ' ls -F ' .a: file
440442 elseif s: IsStagedFile (a: file )
441443 let cmd = ' git diff --staged -- "' .a: file .' "'
442444 elseif s: IsUntrackedFile (a: file )
@@ -516,9 +518,12 @@ function! VimProjectAddChangeDetails(job, data, ...)
516518 call append (0 , a: data )
517519 endif
518520
519- call project#HideNewlines ()
520- silent ! g /^new file mode/ d _
521- silent ! 1 ,4 d _
521+ call project#RemoveEmptyLines ()
522+ silent ! 1 ,g /^new file mode/ d _ | break
523+ silent ! 1 ,g /^diff --git/ d _ | break
524+ silent ! 1 ,g /^index / d _ | break
525+ silent ! 1 ,g /^--- a/ d _ | break
526+ silent ! 1 ,g /^+++ b/ d _ | break
522527 normal ! gg
523528 setlocal nomodifiable
524529 call s: SwitchBuffer (s: changelist_buffer )
0 commit comments