Skip to content

Navigation Menu

Sign in
Sign up

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

Open
sheik wants to merge 2 commits into
gioui:main from
sheik:fix_hyphen_key
Open

adding check if char == '-', if so not using as modifier for keypress #105
sheik wants to merge 2 commits into
gioui:main from
sheik:fix_hyphen_key

Conversation

@sheik

@sheik sheik commented Dec 8, 2022

Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Member

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

sheik commented Dec 8, 2022

Copy link
Copy Markdown
Author

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

@whereswaldon whereswaldon left a comment

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.

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

Comment thread io/key/key.go Outdated
Comment on lines +241 to +245
if chord == "-" {
modSet, keySet = "", chord
} else {
modSet, keySet = chord[:sep], chord[sep+1:]
}

@whereswaldon whereswaldon Dec 8, 2022

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.

Copy link
Copy Markdown
Contributor

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

@whereswaldon whereswaldon left a comment

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.

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

whereswaldon force-pushed the main branch 2 times, most recently from 67c77c9 to 46cc311 Compare May 30, 2024 08:05
whereswaldon force-pushed the main branch 2 times, most recently from f8029f2 to 026d3f9 Compare June 20, 2024 07:54
whereswaldon force-pushed the main branch 11 times, most recently from 072d68c to e8ba786 Compare June 27, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@whereswaldon whereswaldon whereswaldon requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /