Fix #6154
This commit is contained in:
parent
6dcc7ad0c7
commit
3ee77a3a57
@ -28,6 +28,7 @@ func load_config(opts *Options) (ans *Config, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ans.KeyboardShortcuts = config.ResolveShortcuts(ans.KeyboardShortcuts)
|
||||
return ans, nil
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,8 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
@ -288,3 +290,16 @@ func (self *ShortcutTracker) Match(ev *loop.KeyEvent, all_actions []*KeyAction)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ResolveShortcuts(actions []*KeyAction) []*KeyAction {
|
||||
action_map := make(map[string]*KeyAction, len(actions))
|
||||
for _, ac := range actions {
|
||||
key := strings.Join(ac.Normalized_keys, "\x00")
|
||||
if ac.Name == "no_op" || ac.Name == "no-op" {
|
||||
delete(action_map, key)
|
||||
} else {
|
||||
action_map[key] = ac
|
||||
}
|
||||
}
|
||||
return maps.Values(action_map)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user