mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-01-11 22:41:03 +03:00
key.Matches now accepts multiple binding arguments
This commit is contained in:
parent
0f500d5e59
commit
8d3cfdf380
10
key/key.go
10
key/key.go
@ -128,12 +128,14 @@ type Help struct {
|
|||||||
Desc string
|
Desc string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches checks if the given KeyMsg matches a given binding.
|
// Matches checks if the given KeyMsg matches the given bindings.
|
||||||
func Matches(k tea.KeyMsg, b Binding) bool {
|
func Matches(k tea.KeyMsg, b ...Binding) bool {
|
||||||
for _, v := range b.keys {
|
for _, binding := range b {
|
||||||
if k.String() == v && b.Enabled() {
|
for _, v := range binding.keys {
|
||||||
|
if k.String() == v && binding.Enabled() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user