-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bump keyseq to 0.4.0 and add action::trigger*
convenience systems, CHANGE NOTATION, and prep for bevy-input-sequence 0.6.0 release.
#10
Conversation
Test fails but that's ok.
When the last keychord fails to match, we should check if it itself matches something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shanecelis
Thank you for the PR!
I apologize for the delay in responding as I didn't notice the GitHub notification.
There seems to be no problem with the issue.
Not related to this PR, but I thought that the keyseq!
brackets would be better as []
instead of ()
.
The brackets [] will be automatically completed when the user calls the macro by embedding the following example code in the macro's doc comments. (I recently discovered this ( ー̀֊ー́ ))
/// ```
/// keyseq![Ctrl-W Ctrl-D Ctrl-S Ctrl-A]
/// ```
pub fn bevy_pkeyseq(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}
The fix itself is fine, so if there aren't additional fixes, please merge.
Once the merge is confirmed, I'll handle the release on my end. (If it's urgent, you can go ahead with the release as well.)"
Thank you!
I definitely don't like the parentheses (). Cargo's formatter takes weird liberties with what's inside, which is why I had switched to curly braces {}. Apparently one of the few differences between those macro notations are that curly braces permit statements while () and [] only permit expressions. Do you have a link to any docs about the macro [] auto completion? I can put the comment for the code in as you have it, but it doesn't make sense to me. Would the names have to line up? What editor are you using for macro completion? /// ```
/// bevy_pkeyseq![Ctrl-W Ctrl-D Ctrl-S Ctrl-A]
/// ```
pub fn bevy_pkeyseq(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
} |
Bummer. Cargo format does the same to [] as it does to (). Look at this: #[rustfmt::skip]
#[test]
fn before_cargo_format() {
assert_eq!(
[key![Ctrl-A],
key! [Ctrl-A],
key! [ Ctrl-A ],
key!{Ctrl-A},
key! {Ctrl-A},
key! { Ctrl-A },
key!(Ctrl-A),
key! (Ctrl-A),
key! ( Ctrl-A ),
],
[
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
]
);
}
#[test]
fn after_cargo_format() {
assert_eq!(
[
key![Ctrl - A],
key![Ctrl - A],
key![Ctrl - A],
key! {Ctrl-A},
key! {Ctrl-A},
key! { Ctrl-A },
key!(Ctrl - A),
key!(Ctrl - A),
key!(Ctrl - A),
],
[
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
(Modifiers::CONTROL, KeyCode::KeyA),
]
);
} I really don't like how it adds the space between the dash. I want it to look like how it would look in the manual. How do you feel about curly braces? |
@shanecelis |
I checked it on my end, and indeed, the space is being added. |
Elm notified me to this [feature](not-elm/bevy-input-sequence#10 (comment)). I hope it will still work despite the code block being ignored. It's ignored because my procedural macros use the `Modifiers` struct which is located in the `keyseq` crate, so I can't actually have a compilable, runnable test for the 'bevy' or 'winit' features of keyseq-macros.
Hey Elm,
I added some convenience methods to trigger events instead of sending them. But that's not my whopper.
My whopper is that I changed keyseq and published 0.4.0. After a lot of deliberation, I decided to switch to capitalized modifier keys, so
Ctrl-A
instead ofctrl-A
. I also added a feature flag to permit the even more standardCtrl+A
. This change breaks any keyseq users, which right now is only this crate, so I say break 'em while they're small.My hope is to get
bevy-input-sequence
out the door and then push my first release of bevy_minibuffer for bevy 0.14 before bevy 0.15 gets published, which may be as soon as this weekend.If you don't viscerally object to the notation change, let me know how I can help. If you're ok with this PR and permit it, I can publish to crates.io since we're both owners. That's purely an offer to help and expedite if you lack time or access.
Be well!
-Shane