From 7270212214660961df9a06846cdd4a36cf1b6fc0 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 3 May 2015 11:14:34 +0100 Subject: [PATCH] bugfix for secondary trees occurring when the screen state is saved --- lib/nerdtree/ui.vim | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim index 417e6ae..41ec21d 100644 --- a/lib/nerdtree/ui.vim +++ b/lib/nerdtree/ui.vim @@ -325,16 +325,20 @@ endfunction "Saves the current cursor position in the current buffer and the window "scroll position function! s:UI.saveScreenState() + + "FIXME: b:NERDTreeType should really me moved to b:NERDTree.type. Update + "this when that refactor is done + if b:NERDTreeType == "secondary" + return + endif + let win = winnr() - try - call g:NERDTree.CursorToTreeWin() - let self._screenState = {} - let self._screenState['oldPos'] = getpos(".") - let self._screenState['oldTopLine'] = line("w0") - let self._screenState['oldWindowSize']= winwidth("") - call nerdtree#exec(win . "wincmd w") - catch /^NERDTree.InvalidOperationError/ - endtry + call g:NERDTree.CursorToTreeWin() + let self._screenState = {} + let self._screenState['oldPos'] = getpos(".") + let self._screenState['oldTopLine'] = line("w0") + let self._screenState['oldWindowSize']= winwidth("") + call nerdtree#exec(win . "wincmd w") endfunction "FUNCTION: s:UI._stripMarkup(line, removeLeadingSpaces){{{1