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
Open
Changes from all commits
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
11 changes: 10 additions & 1 deletion io/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ const (
NameF11 = "F11"
NameF12 = "F12"
NameBack = "Back"
NameDash = "Dash"
)

// Contain reports whether m contains all modifiers
Expand All @@ -238,7 +239,15 @@ 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 sep == len(chord)-1 {
if sep != 0 {
modSet, keySet = chord[:sep-1], "-"
} else {
modSet, keySet = "", "-"
}
} else {
modSet, keySet = chord[:sep], chord[sep+1:]
}
} else {
modSet, keySet = "", chord
}
Expand Down