@@ -44,8 +44,6 @@ function! s:DiffStatOpenFile(fugitive_command)
4444endfunction
4545
4646
47-
48-
4947" Displays the DiffStat window if show is true, otherwise hide it.
5048function ! s: DisplayWindow (show)
5149 let l: nr = bufwinnr (" __diffstat__" )
@@ -102,7 +100,7 @@ function! s:DisplayWindow(show)
102100
103101endfunction
104102
105- function ! s: DiffStatShortenPath (path , max_path_length)
103+ function ! s: ShortenPath (path , max_path_length)
106104 let l: path = a: path
107105 for [l: pattern , l: replacement ] in items (g: diff_stat_path_simplifications )
108106 let l: path = substitute (l: path , l: pattern , l: replacement , ' ' )
@@ -131,7 +129,7 @@ function! s:DiffStatCommand(command)
131129 if inserts !=# ' 0' || deletes !=# ' 0'
132130 let absolute_path = s: toplevel . ' /' . name
133131 let relative_path = fnamemodify (absolute_path, ' :.' )
134- let display_path_name = s: DiffStatShortenPath (relative_path, max_path_length)
132+ let display_path_name = s: ShortenPath (relative_path, max_path_length)
135133 let files_list[display_path_name] =
136134 \ {' inserts' : inserts, ' deletes' : deletes, ' name' : relative_path}
137135 let l: max_deltas = max ([l: max_deltas , inserts + deletes])
@@ -231,6 +229,7 @@ function! diffstat#run(...)
231229 call add (l: lines , s: GetTotalsString (l: files_list ))
232230 endfor
233231 call append (0 , l: lines )
232+ execute " resize " . min ([len (l: lines ), 15 ])
234233 normal ! G" _ddgg
235234 call setpos (1 , 1 )
236235 setlocal readonly nomodifiable
0 commit comments