Skip to content

Fix tree breaking on directory listings #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bprb
Copy link

@bprb bprb commented Mar 28, 2024

This fixes an error when a buffer contains a folder and another buffer contains a file in that folder.

Example repro steps:

  1. open c:\myfolder in a buffer (a directory listing)
  2. open c:\myfolder\foo.txt in a buffer
  3. run BufferTree

In the first iteration of GetTree, the folder will be added as a buffer_number, not as a dictionary. The second iteration then throws an error when trying to use it as a dictionary in let dir = dir[step].

The fix is to add directories as dictionaries, always.

@bprb
Copy link
Author

bprb commented Mar 28, 2024

Example of the issue:

:ls
  3  h=  "."                            line 1
  4 %a   "test.vim"                     line 1

:BufferTree
Error detected while processing function tree#BufferTree[3]..GetTree:
line   12:
E689: Can only index a List, Dictionary or Blob
└─ C:/Users/username ⇒ 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant