mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-23 02:45:56 +08:00
fix a bug when opening files in a new tab
On bufleave we save the nerdtree window state. However, sometimes when bufleave is triggered the tree is no longer open in this tab - e.g. for secondary trees or mappings that open in another tab. Dont bother saving screen state in these cases as the code doing the saving assumes the tree is available in this tab.
This commit is contained in:
parent
7270212214
commit
da3874cf93
|
@ -325,13 +325,6 @@ 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()
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
let self._screenState = {}
|
||||
|
|
|
@ -148,7 +148,7 @@ call nerdtree#ui_glue#setupCommands()
|
|||
"============================================================
|
||||
augroup NERDTree
|
||||
"Save the cursor position whenever we close the nerd tree
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call b:NERDTree.ui.saveScreenState()"
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
|
||||
|
||||
"disallow insert mode in the NERDTree
|
||||
exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
|
||||
|
|
Loading…
Reference in New Issue
Block a user