Put cursor on root when closing bookmark table

If the cursor is not already positioned on a node when the bookmark
table is closed, then the resulting position of the cursor is not
determined.  Here, we default to positioning the cursor on the
root when the bookmark table is closed.
This commit is contained in:
Jason Franklin 2018-08-02 09:17:18 -04:00
parent eee179f0bf
commit 456367ab07

View File

@ -475,15 +475,23 @@ function! s:UI.toggleIgnoreFilter()
endfunction endfunction
" FUNCTION: s:UI.toggleShowBookmarks() {{{1 " FUNCTION: s:UI.toggleShowBookmarks() {{{1
" toggles the display of bookmarks " Toggle the visibility of the Bookmark table.
function! s:UI.toggleShowBookmarks() function! s:UI.toggleShowBookmarks()
let self._showBookmarks = !self._showBookmarks let self._showBookmarks = !self._showBookmarks
if self.getShowBookmarks() if self.getShowBookmarks()
call self.nerdtree.render() call self.nerdtree.render()
call g:NERDTree.CursorToBookmarkTable() call g:NERDTree.CursorToBookmarkTable()
else else
if empty(g:NERDTreeFileNode.GetSelected())
call b:NERDTree.root.putCursorHere(0, 0)
normal! 0
endif
call self.renderViewSavingPosition() call self.renderViewSavingPosition()
endif endif
call self.centerView() call self.centerView()
endfunction endfunction