nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

fix(#1480): break symlink cycle on find-file, search-node

Open alex-courtis opened this issue 1 year ago • 3 comments

closes #1480

  • detect cycles on search-node S
  • search link paths, not target paths on find-file

expand-all is OK as it stops after max_folder_discovery, however it does follow cycles. We should look at that if time permits.

alex-courtis avatar Aug 02 '22 05:08 alex-courtis

@archiif your testing would be gratefully appreciated.

alex-courtis avatar Aug 02 '22 05:08 alex-courtis

does this change means that nvim-tree will not find file in symlink directories ? I think we should only prevent looping indefinitely right ?

I recall that it did. I'll re-test on the weekend.

alex-courtis avatar Aug 02 '22 22:08 alex-courtis

Thanks a lot for this PR! I did a quick test and it fixed my issue. nvim-tree doesn't seem to track the current directory, so when you C-] into a symlinked directory and go back up again, you end up in the new target directory. So I'm not sure how to test what @kyazdani42 is saying.

archiif avatar Aug 02 '22 23:08 archiif

nvim-tree doesn't seem to track the current directory, so when you C-] into a symlinked directory and go back up again, you end up in the new target directory.

~~That's working as intended: nvim-tree simply finds the file, and find always picks the real directory. That could be changed in the future, but would need some thought.~~

C-] changes to the realpath of the directory. That could be changed in the future, but would need some thought.

alex-courtis avatar Aug 06 '22 05:08 alex-courtis

Still testing...

alex-courtis avatar Aug 06 '22 05:08 alex-courtis

does this change means that nvim-tree will not find file in symlink directories ? I think we should only prevent looping indefinitely right ?

It is not finding files in symlink directories outside cwd. Reworked as a simple cycle detector as per search-node.

alex-courtis avatar Aug 08 '22 01:08 alex-courtis