From bb032a967ee1fe8c6085677455b62316a94b775a Mon Sep 17 00:00:00 2001 From: Jeff Aigner Date: Thu, 8 Dec 2022 07:27:28 -0800 Subject: [PATCH 1/2] adding check if char == '-', if so not using as modifier Fixes: https://todo.sr.ht/~eliasnaur/gio/432 Signed-off-by: Jeff Aigner --- io/key/key.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/io/key/key.go b/io/key/key.go index af31e3e6a..75b942e08 100644 --- a/io/key/key.go +++ b/io/key/key.go @@ -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:] + } } else { modSet, keySet = "", chord } From 226ba35f2673c6554ba6a8f46188555ea09569cd Mon Sep 17 00:00:00 2001 From: Jeff Aigner Date: Thu, 8 Dec 2022 15:01:33 -0800 Subject: [PATCH 2/2] WIP --- io/key/key.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/io/key/key.go b/io/key/key.go index 75b942e08..21c758821 100644 --- a/io/key/key.go +++ b/io/key/key.go @@ -220,6 +220,7 @@ const ( NameF11 = "F11" NameF12 = "F12" NameBack = "Back" + NameDash = "Dash" ) // Contain reports whether m contains all modifiers @@ -238,8 +239,12 @@ func (k Set) Contains(name string, mods Modifiers) bool { var modSet, keySet string sep := strings.LastIndex(chord, "-") if sep != -1 { - if chord == "-" { - modSet, keySet = "", chord + if sep == len(chord)-1 { + if sep != 0 { + modSet, keySet = chord[:sep-1], "-" + } else { + modSet, keySet = "", "-" + } } else { modSet, keySet = chord[:sep], chord[sep+1:] }