@@ -168,7 +168,7 @@ function! s:getUniqueID()
168
168
return s: cntr
169
169
endfunction
170
170
171
- " Debug...
171
+ " Set to 1 to enable debug log
172
172
let s: debug = 0
173
173
let s: debugfile = $HOME .' /undotree_debug.log'
174
174
" If debug file exists, enable debug output.
@@ -307,12 +307,12 @@ endfunction
307
307
308
308
function ! s: undotree .Action (action)
309
309
call s: log (" undotree.Action() " .a: action )
310
- if ! self .IsVisible () || bufname ( " % " ) != self . bufname
311
- echoerr " Fatal: window does not exists ."
310
+ if ! self .IsVisible () || ! exists ( ' b:isUndotreeBuffer ' )
311
+ echoerr " Fatal: window does not exist ."
312
312
return
313
313
endif
314
314
if ! has_key (self ,' Action' .a: action )
315
- echoerr " Fatal: Action does not exists !"
315
+ echoerr " Fatal: Action does not exist !"
316
316
return
317
317
endif
318
318
silent exec ' call self.Action' .a: action .' ()'
@@ -499,6 +499,11 @@ function! s:undotree.Show()
499
499
endif
500
500
call s: exec (" silent keepalt " .cmd)
501
501
call self .SetFocus ()
502
+
503
+ " We need a way to tell if the buffer is belong to undotree,
504
+ " bufname() is not always reliable.
505
+ let b: isUndotreeBuffer = 1
506
+
502
507
setlocal winfixwidth
503
508
setlocal noswapfile
504
509
setlocal buftype = nowrite
@@ -538,8 +543,7 @@ function! s:undotree.Update()
538
543
return
539
544
endif
540
545
" do nothing if we're in the undotree or diff panel
541
- let bufname = bufname (' %' )
542
- if bufname == self .bufname || bufname == t :diffpanel.bufname
546
+ if exists (' b:isUndotreeBuffer' )
543
547
return
544
548
endif
545
549
if (&bt != ' ' && &bt != ' acwrite' ) || (&modifiable == 0 ) || (mode () != ' n' )
@@ -1172,6 +1176,8 @@ function! s:diffpanel.Show()
1172
1176
endif
1173
1177
call s: exec_silent (cmd)
1174
1178
1179
+ let b: isUndotreeBuffer = 1
1180
+
1175
1181
setlocal winfixwidth
1176
1182
setlocal winfixheight
1177
1183
setlocal noswapfile
0 commit comments