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

Add navigation with alt + arrow keys #1264

Merged
merged 4 commits into from
Mar 25, 2022
Merged

Add navigation with alt + arrow keys #1264

merged 4 commits into from
Mar 25, 2022

Conversation

imsnif
Copy link
Member

@imsnif imsnif commented Mar 24, 2022

Recent changes in our STDIN parsing have broken the Alt + [] navigation method. After some investigation, we could not find a method to bring these back without causing crashes for various systems. While it is theoretically possible to get these to work again, it would require a non-trivial amount of work and likely force us to write our own STDIN parser.

Because of this, in a previous PR we moved from parsing STDIN with termion to parsing it with termwiz. Termwiz supports alt + arrow key codes, which allow us to step out of this problem by providing a user friendly alternative.

This PR adds this alternative - allowing pane navigation with Alt + <arrow keys>.

The implementation is a little bit hacky in the configuration parsing front. I'm hoping @a-kenji can have a look and maybe find a better way.

@imsnif imsnif temporarily deployed to cachix March 24, 2022 10:59 Inactive
@imsnif imsnif requested a review from a-kenji March 24, 2022 10:59
@imsnif imsnif temporarily deployed to cachix March 24, 2022 12:29 Inactive
The binding of the keys can now be specified with:

- Alt: 'c'
- Alt: Up
- Alt: Down
- Alt: Left
- Alt: Right
@a-kenji a-kenji temporarily deployed to cachix March 25, 2022 10:48 Inactive
@a-kenji a-kenji temporarily deployed to cachix March 25, 2022 10:48 Inactive
@a-kenji a-kenji temporarily deployed to cachix March 25, 2022 10:49 Inactive
@a-kenji a-kenji temporarily deployed to cachix March 25, 2022 10:49 Inactive
Copy link
Contributor

@a-kenji a-kenji left a comment

Choose a reason for hiding this comment

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

I think this should be ready now!

@imsnif
Copy link
Member Author

imsnif commented Mar 25, 2022

Thanks @a-kenji ! I think it wasn't working for me because I tried to make it:

pub enum CharOrArrow {
    Char(char),
    Right,
    Left,
    Up,
    Down,
}

And gave up trying to figure what Serde wanted from me :) Much appreciated!

@imsnif imsnif merged commit 18ee784 into main Mar 25, 2022
@a-kenji a-kenji deleted the alt-arrows branch March 25, 2022 14:00
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