commit 73322e88d2db49048b05e2dc531d19f4bfd4f907
parent 0620b91efa4041288dc69325c53b3d98e8478536
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Sun, 3 Aug 2008 16:46:48 +1200
fix a bug with the <c-w>o mapping
now we dont assume the cursor is in the nerd tree window when calling
s:SaveScreenState()
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt
@@ -889,6 +889,9 @@ fridge for later ;)
==============================================================================
7. Changelog *NERDTreeChangelog*
+2.x.x
+ - fix a bug where the <c-w>o mapping would cause the tree window to be
+ incorrectly sized when reopened.
2.13.0
- make NERDTreeChDir option default to 0 (i.e. never change vims current
working dir by default)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -146,7 +146,7 @@ command! -n=1 -complete=customlist,s:CompleteBookmarks NERDTreeFromBookmark call
" SECTION: Auto commands {{{1
"============================================================
"Save the cursor position whenever we close the nerd tree
-exec "autocmd BufWinLeave *". s:NERDTreeWinName ."* :call <SID>SaveScreenState()"
+exec "autocmd BufWinLeave *". s:NERDTreeWinName ." call <SID>SaveScreenState()"
"cache bookmarks when vim loads
autocmd VimEnter * call s:oBookmark.CacheBookmarks(0)
@@ -2621,12 +2621,13 @@ endfunction
"FUNCTION: s:SaveScreenState() {{{2
"Saves the current cursor position in the current buffer and the window
"scroll position
-"
-"Assumes the cursor is in the NERDTree window
function! s:SaveScreenState()
+ let win = winnr()
+ call s:PutCursorInTreeWin()
let t:NERDTreeOldPos = getpos(".")
let t:NERDTreeOldTopLine = line("w0")
let t:NERDTreeOldWindowSize = s:ShouldSplitVertically() ? winwidth("") : winheight("")
+ exec win . "wincmd w"
endfunction
"FUNCTION: s:SetupSyntaxHighlighting() {{{2