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

Allow key.Matches to accept multiple binding arguments #84

Merged
merged 1 commit into from Jan 10, 2022

Conversation

meowgorithm
Copy link
Member

@meowgorithm meowgorithm commented Dec 20, 2021

key.Binding currently allows you to bind against multiple keys:

binding := key.Binding(key.WithKeys("q", "ctrl+c"))

However, sometimes you may also want to match on multiple bindings at once:

left := key.Binding(key.WithKeys("h", "left"))
right := key.Binding(key.WithKeys("l", "right"))

case key.Matches(msg, left), key.Matches(msg, right):

This update expands key.Matches to accept multiple arguments so you can condense the above case statement to:

case key.Matches(msg, left, right):

@meowgorithm meowgorithm changed the title key.Matches now accepts multiple arguments Allow key.Matches to accept multiple binding arguments Dec 20, 2021
@meowgorithm meowgorithm merged commit 8d3cfdf into master Jan 10, 2022
@meowgorithm meowgorithm deleted the key-matches-multiarg branch January 10, 2022 17:32
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.

None yet

1 participant