mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Fix #6154
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user