ms-jpq / chadtree

File manager for Neovim. Better than NERDTree.
1.62k stars 60 forks source link

skip adding the root node as a child to itself #360

Closed vasac closed 3 months ago

vasac commented 4 months ago

The root node (/) points to itself as a parent, so when chadtree attempts to display the root folder, this error occurs:

maximum recursion depth exceeded
Traceback (most recent call last):
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/.vars/runtime/lib/python3.12/site-packages/pynvim_pp/logging.py", line 31, in suppress_and_log
    yield None
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/client.py", line 188, in c2
    await redraw(state, focus=stage.focus)
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/transitions/redraw.py", line 76, in redraw
    focus_row = state.derived.path_row_lookup.get(focus) if focus else None
                ^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/state/cache.py", line 13, in derived
    return render(
           ^^^^^^^
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/view/render.py", line 315, in render
    _nodes, _lines, _highlights, _badges = zip(*rendered)
                                           ^^^^^^^^^^^^^^
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/view/render.py", line 309, in render
    children = tuple(gen_children())
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/view/render.py", line 307, in gen_children
    yield from render(child, depth=depth + 1, cleared=clear)
  File "/Users/vasac/.local/share/nvim/lazy/chadtree/chadtree/view/render.py", line 309, in render
    children = tuple(gen_children())
               ^^^^^^^^^^^^^^^^^^^^^
ms-jpq commented 3 months ago

ty!