starting to separate tree and nerdtree

This commit is contained in:
Amber 2024-03-19 09:06:25 +01:00
parent c272cba222
commit 6c4ad0dd3d
1 changed files with 10 additions and 13 deletions

View File

@ -3,7 +3,6 @@ from pathlib import Path
from src.colors import RED, YELLOW, GREEN, CYAN , BLUE, PURPLE
import src.tree_repr as _tree_repr
import src.tree_find as _tree_find
class NerdTree():
'''
@ -212,15 +211,14 @@ class NerdTree():
items = rootnode.get('children') or []
if isinstance(self, _tree_find.NerdTreeFind):
nodefound = rootnode.get('found')
if nodefound:
if self.find_opts['dont_show_children_nodes'] or self.find_opts['show_subtree_info']:
if rootnode.get('subtree_items'):
hnum, unit = _tree_repr.format(rootnode['subtree_size'])
nerd_tree_txt += ' (%s item(s)/%s%s ▾)' % (rootnode['subtree_items'], hnum, unit)
nodefound = rootnode.get('found')
if nodefound:
if self.find_opts['dont_show_children_nodes'] or self.find_opts['show_subtree_info']:
if rootnode.get('subtree_items'):
hnum, unit = _tree_repr.format(rootnode['subtree_size'])
nerd_tree_txt += ' (%s item(s)/%s%s ▾)' % (rootnode['subtree_items'], hnum, unit)
if self.find_opts['dont_show_children_nodes']: items = []
if self.find_opts['dont_show_children_nodes']: items = []
for n, item in enumerate(items):
# if item['name'] in _tree_repr.ITEMS_TO_EXCLUDE:
@ -243,10 +241,9 @@ class NerdTree():
treeline = _tree_repr.produce_treeline(prec_seps, (sep, {'name' : ' '})) + ' ' + self.tree_from_struct(item, prec_seps=seps)
else:
treeline = _tree_repr.produce_treeline(prec_seps, (sep, item))
if isinstance(self, _tree_find.NerdTreeFind):
if item.get('found') and self.find_opts['show_subtree_info']:
hnum, unit = _tree_repr.format(item['size'])
treeline += ' (%s%s)' % (hnum, unit)
if item.get('found') and self.find_opts['show_subtree_info']:
hnum, unit = _tree_repr.format(item['size'])
treeline += ' (%s%s)' % (hnum, unit)
nerd_tree_txt += '\n' + treeline