Skip to content
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

Changing source from Any source to Filesystem closes and reopens neo-tree instead of switching source #713

Closed
braxtons12 opened this issue Jan 24, 2023 · 6 comments
Assignees
Labels
bug Something isn't working working-on-it

Comments

@braxtons12
Copy link

Title says it all, switching source, either by clicking the source_selector or pressing "<" or ">", from one source (eg git_status), back to filesystem causes neo-tree to close then reopen on the filesystem source, instead of just switching to filesystem. This causes a jarring flash of the main window growing to the left then shrinking back when neo-tree reopens. This all occurs in ~1 second (or less).

@pysan3
Copy link
Collaborator

pysan3 commented Feb 5, 2023

I am able to reproduce this but not sure why this is happening.

I will dig into this since it might be related to the source selector.

@pysan3
Copy link
Collaborator

pysan3 commented Feb 6, 2023

So, I now found out what the cause is. (commenting mainly for my memo)

For all sources, the logic is that the window for the previous source is closed here and then a new window for the next source is calculated afterwards.

This causes a jarring flash of the main window.

So this is actually a feature and not a bug now.

The reason why we cannot observe a flash on buffers / git source etc is that the new buffer is calculated synchronously and therefore, all happens before any rendering update of neovim.
(Technically, there is no vim.schedule or other async functions between the previous delete and the spawning of new tree)

So, @braxtons12, if you really hate seeing the flickering, an urgent fix would be to set these options in config to make everything calculated in sync, just like other sources.
However, I would not recommend this setting because (obviously) it does everything synchronously meaning Neotree would require time to show up and neovim completely hangs during that period (which is but like half second so might be better than having flickering? Up to you).

config = {
  git_status_async = false,
  filesystem = {
    async_directory_scan = "never",
  },
}

I believe we can delay the deletion of previous buffer, hence the window, until the calculation is done and shift the deletion to the same rendering frame of creating the new window to avoid this issue.

I will try to implement a solution and create a PR.

@charbelnicolas
Copy link

Ohh yes, I've been noticing this behavior recently too and the flicker is a bit annoying

@charbelnicolas
Copy link

2023-02-13_14-32-17.mp4

@pysan3
Copy link
Collaborator

pysan3 commented Feb 15, 2023

Hi, I have created a PR aiming to solve this issue at #752.

I would be more than happy if you could test it out with your default configs.
And also would like to hear your feedbacks. Mainly about the performance.

Thanks in advance ;)

@cseickel
Copy link
Contributor

I think this is now fixed in main with #1011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working working-on-it
Projects
None yet
Development

No branches or pull requests

5 participants