Skip to content

fix: auto_expand_width gets caught in infinite loop and hangs neovim (#624) #627

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

Merged
merged 3 commits into from
Nov 26, 2022
Merged

fix: auto_expand_width gets caught in infinite loop and hangs neovim (#624) #627

merged 3 commits into from
Nov 26, 2022

Conversation

pysan3
Copy link
Collaborator

@pysan3 pysan3 commented Nov 26, 2022

Should fix #624.

For more info and discussion, please read the above issue.

@codecov
Copy link

codecov bot commented Nov 26, 2022

Codecov Report

Merging #627 (b0b2c29) into main (e003910) will increase coverage by 0.04%.
The diff coverage is 28.57%.

@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
+ Coverage   50.45%   50.49%   +0.04%     
==========================================
  Files          47       47              
  Lines        6099     6103       +4     
==========================================
+ Hits         3077     3082       +5     
+ Misses       3022     3021       -1     
Impacted Files Coverage Δ
lua/neo-tree/ui/renderer.lua 69.60% <16.66%> (-0.45%) ⬇️
lua/neo-tree/sources/common/container.lua 67.03% <100.00%> (ø)
lua/neo-tree/utils.lua 47.57% <0.00%> (+0.25%) ⬆️
lua/neo-tree/sources/filesystem/init.lua 66.10% <0.00%> (+1.69%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@cseickel cseickel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great for me!

@cseickel cseickel merged commit 9fd08eb into nvim-neo-tree:main Nov 26, 2022
@cseickel
Copy link
Contributor

Actually, this is still not quite right. I just got into a situation where I could not scroll vertically in a neo-tree window because every movement caused a re-render and put me back to the top of the window.

I disabled the feature in my own config for now. I think this can use some more work.

@pysan3
Copy link
Collaborator Author

pysan3 commented Nov 27, 2022

@cseickel Thanks for testting.

Could you give me a minimal way to reproduce your issue?

I really cannot have the same behavior with my setup and I have no issues whatsoever.

And could you test what happens when auto_expand_width = false and toggle it on with keybind after opening neo-tree.

The rendering should only happen on what was already implementing before adding this feature or when the rendering text length exceeds the width of the window.
I could not think of a reason why this feature interferes with scrolling.

Thanks in advance.

@cseickel
Copy link
Contributor

cseickel commented Nov 27, 2022

@pysan3 I think this is the core issue:

render_tree(state)

That creates an infinite loop of renders whenever the auto_expand code is actually triggered.

I ended up rewriting the logic to be more direct and ensure there is only one extra render. I'm also making it something that can be reused for position = current and float. I'm not quite done with that but the code is in #629.

EDIT: now #629 is done and merged. We should be good now.

@pysan3
Copy link
Collaborator Author

pysan3 commented Nov 29, 2022

@cseickel Thank you so so much!!

Your rewrite works like a charm!

@pysan3 pysan3 deleted the fix-auto-expand-infinite-loop branch November 29, 2022 07:20
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.

2 participants