@@ -176,6 +176,17 @@ endif
176
176
" CLASS: Bookmark {{{2
177
177
" ============================================================
178
178
let s: Bookmark = {}
179
+ " FUNCTION: Bookmark.activate() {{{3
180
+ function ! s: Bookmark .activate ()
181
+ if self .path .isDirectory
182
+ call self .toRoot ()
183
+ else
184
+ if self .validate ()
185
+ let n = s: TreeFileNode .New (self .path )
186
+ call n .open ()
187
+ endif
188
+ endif
189
+ endfunction
179
190
" FUNCTION: Bookmark.AddBookmark(name, path) {{{3
180
191
" Class method to add a new bookmark to the list, if a previous bookmark exists
181
192
" with the same name, just update the path for that bookmark
@@ -426,6 +437,13 @@ endfunction
426
437
" classes.
427
438
" ============================================================
428
439
let s: TreeFileNode = {}
440
+ " FUNCTION: TreeFileNode.activate(forceKeepWinOpen) {{{3
441
+ function ! s: TreeFileNode .activate (forceKeepWinOpen)
442
+ call self .open ()
443
+ if ! a: forceKeepWinOpen
444
+ call s: closeTreeIfQuitOnOpen ()
445
+ end
446
+ endfunction
429
447
" FUNCTION: TreeFileNode.bookmark(name) {{{3
430
448
" bookmark this node with a:name
431
449
function ! s: TreeFileNode .bookmark (name)
@@ -974,6 +992,13 @@ function! s:TreeDirNode.AbsoluteTreeRoot()
974
992
endwhile
975
993
return currentNode
976
994
endfunction
995
+ " FUNCTION: TreeDirNode.activate(forceKeepWinOpen) {{{3
996
+ unlet s: TreeDirNode .activate
997
+ function ! s: TreeDirNode .activate (forceKeepWinOpen)
998
+ call self .toggleOpen ()
999
+ call s: renderView ()
1000
+ call self .putCursorHere (0 , 0 )
1001
+ endfunction
977
1002
" FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{3
978
1003
" Adds the given treenode to the list of children for this node
979
1004
"
@@ -3028,27 +3053,11 @@ function! s:activateNode(forceKeepWindowOpen)
3028
3053
3029
3054
let treenode = s: TreeFileNode .GetSelected ()
3030
3055
if treenode != {}
3031
- if treenode.path .isDirectory
3032
- call treenode.toggleOpen ()
3033
- call s: renderView ()
3034
- call treenode.putCursorHere (0 , 0 )
3035
- else
3036
- call treenode.open ()
3037
- if ! a: forceKeepWindowOpen
3038
- call s: closeTreeIfQuitOnOpen ()
3039
- end
3040
- endif
3056
+ call treenode.activate (a: forceKeepWindowOpen )
3041
3057
else
3042
3058
let bookmark = s: getSelectedBookmark ()
3043
3059
if ! empty (bookmark)
3044
- if bookmark.path .isDirectory
3045
- call bookmark.toRoot ()
3046
- else
3047
- if bookmark.validate ()
3048
- let n = s: TreeFileNode .New (bookmark.path )
3049
- call n .open ()
3050
- endif
3051
- endif
3060
+ call bookmark.activate ()
3052
3061
endif
3053
3062
endif
3054
3063
endfunction
0 commit comments