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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crossterm to 0.26.1 (fixed examples and add proper key release) #23

Merged
merged 7 commits into from
Apr 6, 2023

Conversation

lesleyrs
Copy link
Contributor

@lesleyrs lesleyrs commented Apr 6, 2023

I didn't implement window focus or paste because I'm not sure how, it just returns () now so it doesn't panic.

There's also a new KeyEventState which I didn't use because I think it requires kitty keyboard protocol in order to work. Which windows terminal/conhost doesn't support so maybe leave it for now.

Lastly I noticed that in --example shapes holding down S or F which checks for key press not hold does the action a second time after a few frames. But this happens in crossterm 0.24 as well so it's unrelated to this.

Closes #16 you could make a new issues for window focus, paste and the double key press? Fixes #22

This change now allows for smooth movement using console engine like I was trying to get in my issue 馃憤 .

@lesleyrs
Copy link
Contributor Author

lesleyrs commented Apr 6, 2023

Some more info here crossterm-rs/crossterm#772 (comment)

Copy link
Owner

@VincentFoulon80 VincentFoulon80 left a comment

Choose a reason for hiding this comment

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

Thank you 馃檱

@lesleyrs
Copy link
Contributor Author

lesleyrs commented Apr 6, 2023

Just added a smooth scrolling example that showcases it compared to normal scroll, however there's 1 issue with my idea:

If you press another key without releasing the original one, then let go of it later, you can get a delayed release event which stops the scrolling for a little.

For some reason even if I check if the original key is still being pressed, the code still gets triggered. But this is good enough for now.

It would be really amazing to get it to work perfect natively in terminal imo, the only other crates I've seen that do this get input from outside the terminal which is less cool.

@VincentFoulon80
Copy link
Owner

VincentFoulon80 commented Apr 6, 2023

We can figure that out later if you're willing to get it to work perfectly 馃槈

Do you think your branch is ready to merge, or is there something else you'd like to add ?

@lesleyrs
Copy link
Contributor Author

lesleyrs commented Apr 6, 2023

I think key release events are windows only so I'll add a comment to the example right now, you can version bump yourself after this.

That's it.

@VincentFoulon80 VincentFoulon80 merged commit d0aa572 into VincentFoulon80:master Apr 6, 2023
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.

is_key_released gets triggered when the key isn't being released Bump crossterm version to 0.25
2 participants