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()
This commit is contained in:
Martin Grenfell
2008-08-03 16:46:48 +12:00
parent 0620b91efa
commit 73322e88d2
2 changed files with 7 additions and 3 deletions

View File

@@ -889,6 +889,9 @@ fridge for later ;)
============================================================================== ==============================================================================
7. Changelog *NERDTreeChangelog* 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 2.13.0
- make NERDTreeChDir option default to 0 (i.e. never change vims current - make NERDTreeChDir option default to 0 (i.e. never change vims current
working dir by default) working dir by default)

View File

@@ -146,7 +146,7 @@ command! -n=1 -complete=customlist,s:CompleteBookmarks NERDTreeFromBookmark call
" SECTION: Auto commands {{{1 " SECTION: Auto commands {{{1
"============================================================ "============================================================
"Save the cursor position whenever we close the nerd tree "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 "cache bookmarks when vim loads
autocmd VimEnter * call s:oBookmark.CacheBookmarks(0) autocmd VimEnter * call s:oBookmark.CacheBookmarks(0)
@@ -2621,12 +2621,13 @@ endfunction
"FUNCTION: s:SaveScreenState() {{{2 "FUNCTION: s:SaveScreenState() {{{2
"Saves the current cursor position in the current buffer and the window "Saves the current cursor position in the current buffer and the window
"scroll position "scroll position
"
"Assumes the cursor is in the NERDTree window
function! s:SaveScreenState() function! s:SaveScreenState()
let win = winnr()
call s:PutCursorInTreeWin()
let t:NERDTreeOldPos = getpos(".") let t:NERDTreeOldPos = getpos(".")
let t:NERDTreeOldTopLine = line("w0") let t:NERDTreeOldTopLine = line("w0")
let t:NERDTreeOldWindowSize = s:ShouldSplitVertically() ? winwidth("") : winheight("") let t:NERDTreeOldWindowSize = s:ShouldSplitVertically() ? winwidth("") : winheight("")
exec win . "wincmd w"
endfunction endfunction
"FUNCTION: s:SetupSyntaxHighlighting() {{{2 "FUNCTION: s:SetupSyntaxHighlighting() {{{2