make cascading dirs more compact

Render cascading dirs on one line i.e.

    > foo/bar/baz
      file1

instead of

    > foo
      > bar
        > baz
          > file1

This should be useful things like java projects that have deep dir
structures.

Remove the old UI view (pre the dir arrows) as this simply isnt worth
supporting for a proof of concept. This may get added back - or not.
This commit is contained in:
Martin Grenfell
2015-11-24 11:18:25 +00:00
parent ee4d42cfed
commit 2cef8bb602
2 changed files with 39 additions and 60 deletions

View File

@@ -73,6 +73,24 @@ function! s:TreeDirNode.createChild(path, inOrder)
return newTreeNode
endfunction
"FUNCTION: TreeDirNode.displayString() {{{1
unlet s:TreeDirNode.displayString
function! s:TreeDirNode.displayString()
let vc = self.getVisibleChildren()
if len(vc) != 1
return self.path.displayString()
endif
let visChild = vc[0]
"TODO: optimize
if !visChild.path.isDirectory
return self.path.displayString()
endif
return self.path.getLastPathComponent(1) . visChild.displayString()
endfunction
"FUNCTION: TreeDirNode.findNode(path) {{{1
"Will find one of the children (recursively) that has the given path
"
@@ -218,6 +236,13 @@ function! s:TreeDirNode.hasVisibleChildren()
return self.getVisibleChildCount() != 0
endfunction
"FUNCTION: TreeDirNode.isCascadable() {{{1
"true if this dir has only one visible child - which is also a dir
function! s:TreeDirNode.isCascadable()
let c = self.getVisibleChildren()
return len(c) == 1 && c[0].path.isDirectory
endfunction
"FUNCTION: TreeDirNode._initChildren() {{{1
"Removes all childen from this node and re-reads them
"