Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion io/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ func (k Set) Contains(name string, mods Modifiers) bool {
var modSet, keySet string
sep := strings.LastIndex(chord, "-")
if sep != -1 {
modSet, keySet = chord[:sep], chord[sep+1:]
if chord == "-" {
modSet, keySet = "", chord
} else {
modSet, keySet = chord[:sep], chord[sep+1:]
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps I am misreading, but this seems like it would only work to bind to literal presses of -. It doesn't handle modifier keys in combination with - such as Short-- or Ctrl--. Here's a playground demonstrating some of the failure cases. I think whatever we do needs to handle all of the ones I put in the playground, probably by detecting when the final character is - and doing special processing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ahh good point. I will be implementing these in my app soon so I'll update the PR when I do so.

} else {
modSet, keySet = "", chord
}
Expand Down