-
Notifications
You must be signed in to change notification settings - Fork 288
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
Make release event an opt-in feature #778
base: master
Are you sure you want to change the base?
Conversation
@lesleyrs you can potentially keep the pull requests open. Guess it might be cleaner anyways to have this explicit check for press events even if not enabling the feature introduced in this pr. |
Ok sounds good, I made it a mission to fix those libraries prior to this PR as the breakage was really quite bad for such a simple fix. But I'll try to get them merged still then. |
Is there still interest in getting this merged? Seems that a lot of people are still getting bit by this (most recently #973). I'm happy to resolve the merge conflicts and create an updated PR if it would help. |
I think this disabling release / repeat events by default is a good idea to continue moving forward on, but making it a feature flag is probably not the right way to have this work. This is because feature unification means that any other dependency your app relies on could enable the feature and break your app's code. This sort of spooky action at a distance is almost as bad as the problem that it's solving. Instead, what about making this runtime configurable? I'm not sure what exactly that would look like / where the methods to enable this should in general live. This of course also has some downsides (all the arguments about global mutable state apply here), so choosing this over the feature flag approach may not be obvious (I'm only 60/40 on the idea as being a better approach). A third option that avoids global mutable state would be to always ignore the events in We also recently added a bunch of helper methods in #949 which explicitly push users towards just getting the key press events rather than all events. Having those methods in your face when using code completion / API docs might make app bugs when using the events less frequent. |
I agree, using a feature flag for this is maybe not the best way. I think we could add a configuration object for this and pass it into a new // Would not report key up or key repeat by default
read()?;
let options = ReadOptions::new().key_up(true).key_repeat(true);
read_with(&options)?; or let reader = EventReader::new().key_up(true).key_repeat(true);
reader.read()?; This would also need to be added to let stream = EventStream::new().key_up(true).key_repeat(true);
stream.next().await?; There is already an internal event filter so this shouldn't be a large change. |
Event::Release
andEvent::Repeat
an opt in rather then default enabled feature on windows and kitty. The motivation is that it isn't fully cross-platform and causes developers confusion when receiving two events unexpectedly.Enter
release event at application start up.Fixes: #752