Skip to content

fix(#1785): retain focused node following filter toggle #1872

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

Closed
wants to merge 1 commit into from

Conversation

alex-courtis
Copy link
Member

fixes #1785

I was only briefly tempted to do this for all reloads, as there may be assumptions around the cursor location.

@gegoune
Copy link
Collaborator

gegoune commented Jan 2, 2023

Seems to be working well when highlighted file is opened in nvim.
If file is not opened cursor will jump to first line of tree and remain there when switching filter on and off. Seem like it just doesn't have an entry to jump to.

You can test it by opening unchanged (git) file and filtering with C. It will work OK when you open and "find" changed file.

@alex-courtis
Copy link
Member Author

If file is not opened cursor will jump to first line of tree and remain there when switching filter on and off. Seem like it just doesn't have an entry to jump to.

That is a problem. I'll have a play and try and come up with something "natural".

@alex-courtis
Copy link
Member Author

The problem I'd like to solve is the filter not retaining focus on the node, when it is visible before and after filter toggle.

Options for "node no longer visible" case:

  1. Focus root
  2. Focus lowest visible parent folder if present
  3. Do nothing

1 is jarring, 3 is current behaviour.

I'll try 2 and see how it looks.

@alex-courtis
Copy link
Member Author

Abandoning. Things get complicated when it comes to folders and nothing felt quite right.

A solution will present itself at some point.

@alex-courtis alex-courtis deleted the 1785-focus-after-filter-toggle branch January 10, 2023 02:21
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.

Focus Incorrect After Filter Toggle
2 participants