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

adding check if char == '-', if so not using as modifier for keypress #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sheik
Copy link

@sheik sheik commented Dec 8, 2022

No description provided.

@whereswaldon
Copy link
Member

Thanks for the PR! Please sign off your commit message.

@sheik
Copy link
Author

sheik commented Dec 8, 2022

Done. Please let me know if I've done something incorrectly 🤪

Copy link
Member

@whereswaldon whereswaldon left a comment

Choose a reason for hiding this comment

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

I think there're some unhanded edge cases, but thanks for tackling this!

io/key/key.go Outdated
Comment on lines 241 to 245
if chord == "-" {
modSet, keySet = "", chord
} else {
modSet, keySet = chord[:sep], chord[sep+1:]
}
Copy link
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
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.

@eliasnaur
Copy link
Contributor

LGTM, but an addition to io/key/key_test.go would be nice.

Copy link
Member

@whereswaldon whereswaldon left a comment

Choose a reason for hiding this comment

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

Nice work! A test would, as @eliasnaur says, be appreciated. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants