Skip to content

Commit 2612dad

Browse files
committed
Makes undotree work with plugins that fold diffs.
Some plugins fold diffs by default. If such a plugin is installed along with undotree, `diffpanel.Show()` sets the filetype for diffpanel to `diff`, which results in a big, happy, closed fold. Then `undotree.Draw()` helpfully tries to deletes the last line in the diff buffer, believing it empty. Except, said line is now the fold. The patch addresses this problem by opening the fold, if any. Perhaps a better fix would be to make sure the deleted line is actually empty before removing it.
1 parent 98300f4 commit 2612dad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugin/undotree.vim

+3-1
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,6 @@ function! s:diffpanel.Show()
11081108
setlocal buftype=nowrite
11091109
setlocal bufhidden=delete
11101110
setlocal nowrap
1111-
setlocal foldcolumn=0
11121111
setlocal nobuflisted
11131112
setlocal nospell
11141113
setlocal nonumber
@@ -1121,6 +1120,9 @@ function! s:diffpanel.Show()
11211120

11221121
" syntax need filetype autocommand
11231122
setfiletype diff
1123+
setlocal foldcolumn=0
1124+
setlocal nofoldenable
1125+
11241126
call self.BindAu()
11251127
call t:undotree.SetFocus()
11261128
call winrestview(savedview)

0 commit comments

Comments
 (0)