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

feat(TreeEditor): add keyboard support - arrow key move / expand #74

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

John-Paul-R
Copy link

Hello, and happy Modtoberfest!

This PR adds the ability to navigate the TreeEditor with via keyboard Up,Down,Left,Right or HJKL (vim keys).

I tried to mirror vscode's file tree navigation behavior pretty closely since, well, we're in vscode. (and I think vscode's behavior here is reasonable). A known exception in this current iteration is that Down when on the last item in a container doesn't take you to the item after the container. (and Down when on the root item of a container takes you to that container's sibling, rather than entering the container (Right is used for that)). This might be worth changing, but I'm fairly happy with where this is at right now.

I tried not to restructure things too much, so I computed most of the "next item" fun on the fly, rather than modifying the core tree data structure to support it. (A new structure, or added cache, at least, might be helpful on super big objects, but I think this will be more than fast enough for the vast majority of files.)


Demo!

2024-10-12_14-32-19.c.mp4

@John-Paul-R John-Paul-R changed the title feat(TreeEditor): add keyboard arrow key move / expand support feat(TreeEditor): add keyboard support - arrow key move / expand Oct 12, 2024
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