Skip to content

Commit

Permalink
Update gocui module
Browse files Browse the repository at this point in the history
  • Loading branch information
markruler committed Dec 27, 2020
1 parent 3430221 commit 5e9380d
Show file tree
Hide file tree
Showing 19 changed files with 237 additions and 53 deletions.
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.13
require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/awesome-gocui/gocui v0.6.0
github.com/cespare/xxhash v1.1.0
github.com/docker/cli v0.0.0-20190906153656-016a3232168d
github.com/docker/distribution v2.7.1+incompatible // indirect
Expand All @@ -17,17 +18,14 @@ require (
github.com/google/go-cmp v0.3.0 // indirect
github.com/google/uuid v1.1.1
github.com/gorilla/mux v1.7.2 // indirect
github.com/jroimartin/gocui v0.4.0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/logrusorgru/aurora v0.0.0-20190803045625-94edacc10f9b
github.com/lunixbochs/vtclean v1.0.0
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/morikuni/aec v1.0.0 // indirect
github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
Expand All @@ -40,7 +38,6 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.4.0 // indirect
github.com/wagoodman/keybinding v0.0.0-20181213133715-6a824da6df05
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect
golang.org/x/text v0.3.2 // indirect
Expand Down
17 changes: 6 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/awesome-gocui/gocui v0.6.0 h1:hhDJiQC12tEsJNJ+iZBBVaSSLFYo9llFuYpQlL5JZVI=
github.com/awesome-gocui/gocui v0.6.0/go.mod h1:1QikxFaPhe2frKeKvEwZEIGia3haiOxOUXKinrv17mA=
github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc h1:wGNpKcHU8Aadr9yOzsT3GEsFLS7HQu8HxQIomnekqf0=
github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc/go.mod h1:tOy3o5Nf1bA17mnK4W41gD7PS3u4Cv0P0pqFcoWMy8s=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down Expand Up @@ -47,6 +51,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
Expand All @@ -64,7 +70,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golangci/golangci-lint v1.32.0 h1:3wL5pvhTpRvlvtosoZecS+hu40IAiJl1qlZQuXIFBAg=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand All @@ -83,8 +88,6 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jroimartin/gocui v0.4.0 h1:52jnalstgmc25FmtGcWqa0tcbMEWS6RpFLsOIO+I+E8=
github.com/jroimartin/gocui v0.4.0/go.mod h1:7i7bbj99OgFHzo7kB2zPb8pXLqMBSQegY7azfqXMkyY=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
Expand Down Expand Up @@ -113,8 +116,6 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
Expand All @@ -126,10 +127,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylrrA+BAMrzYkdAoiTaKPVxRB+4cyM=
github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317 h1:hhGN4SFXgXo61Q4Sjj/X9sBjyeSa2kdpaOzCO+8EVQw=
github.com/nsf/termbox-go v0.0.0-20190817171036-93860e161317/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
Expand Down Expand Up @@ -197,8 +194,6 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/wagoodman/keybinding v0.0.0-20181213133715-6a824da6df05 h1:YMcRwVDe8DLDZ/vrhuImCfqjjG/+gZs6SF61DDQkL/8=
github.com/wagoodman/keybinding v0.0.0-20181213133715-6a824da6df05/go.mod h1:gXFkc2sM2o06uzn5Lgo6Ql76uweGdxNfeAlFyKiHAdk=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
Expand Down
7 changes: 4 additions & 3 deletions runtime/ui/app.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package ui

import (
"sync"

"github.com/wagoodman/dive/dive/image"
"github.com/wagoodman/dive/runtime/ui/key"
"github.com/wagoodman/dive/runtime/ui/layout"
"github.com/wagoodman/dive/runtime/ui/layout/compound"
"sync"

"github.com/jroimartin/gocui"
"github.com/awesome-gocui/gocui"
"github.com/sirupsen/logrus"
"github.com/wagoodman/dive/dive/filetree"
)
Expand Down Expand Up @@ -130,7 +131,7 @@ func (a *app) quit() error {
func Run(imageName string, analysis *image.AnalysisResult, treeStack filetree.Comparer) error {
var err error

g, err := gocui.NewGui(gocui.OutputNormal)
g, err := gocui.NewGui(gocui.OutputNormal, true)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/ui/controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ui

import (
"github.com/jroimartin/gocui"
"github.com/awesome-gocui/gocui"
"github.com/sirupsen/logrus"
"github.com/wagoodman/dive/dive/filetree"
"github.com/wagoodman/dive/dive/image"
Expand Down
15 changes: 8 additions & 7 deletions runtime/ui/key/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package key

import (
"fmt"
"github.com/jroimartin/gocui"

"github.com/awesome-gocui/gocui"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/wagoodman/dive/runtime/ui/format"
"github.com/wagoodman/keybinding"
// "github.com/wagoodman/keybinding"
)

type BindingInfo struct {
Expand All @@ -19,7 +20,7 @@ type BindingInfo struct {
}

type Binding struct {
key []keybinding.Key
key []Key
displayName string
selectedFn func() bool
actionFn func() error
Expand Down Expand Up @@ -52,11 +53,11 @@ func GenerateBindings(gui *gocui.Gui, influence string, infos []BindingInfo) ([]
}

func NewBinding(gui *gocui.Gui, influence string, key gocui.Key, mod gocui.Modifier, displayName string, actionFn func() error) (*Binding, error) {
return newBinding(gui, influence, []keybinding.Key{{Value: key, Modifier: mod}}, displayName, actionFn)
return newBinding(gui, influence, []Key{{Value: key, Modifier: mod}}, displayName, actionFn)
}

func NewBindingFromConfig(gui *gocui.Gui, influence string, configKeys []string, displayName string, actionFn func() error) (*Binding, error) {
var parsedKeys []keybinding.Key
var parsedKeys []Key
for _, configKey := range configKeys {
bindStr := viper.GetString(configKey)
if bindStr == "" {
Expand All @@ -65,7 +66,7 @@ func NewBindingFromConfig(gui *gocui.Gui, influence string, configKeys []string,
}
logrus.Debugf("parsing keybinding '%s' --> '%s'", configKey, bindStr)

keys, err := keybinding.ParseAll(bindStr)
keys, err := ParseAll(bindStr)
if err != nil {
return nil, err
}
Expand All @@ -82,7 +83,7 @@ func NewBindingFromConfig(gui *gocui.Gui, influence string, configKeys []string,
return newBinding(gui, influence, parsedKeys, displayName, actionFn)
}

func newBinding(gui *gocui.Gui, influence string, keys []keybinding.Key, displayName string, actionFn func() error) (*Binding, error) {
func newBinding(gui *gocui.Gui, influence string, keys []Key, displayName string, actionFn func() error) (*Binding, error) {
binding := &Binding{
key: keys,
displayName: displayName,
Expand Down
186 changes: 186 additions & 0 deletions runtime/ui/key/key.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
package key

import (
"fmt"
"strings"
"unicode"

"github.com/awesome-gocui/gocui"
)

var translate = map[string]string{
"/": "Slash",
"\\": "Backslash",
"[": "LsqBracket",
"]": "RsqBracket",
"_": "Underscore",
"escape": "Esc",
"~": "Tilde",
"pageup": "Pgup",
"pagedown": "Pgdn",
"pgup": "Pgup",
"pgdown": "Pgdn",
"up": "ArrowUp",
"down": "ArrowDown",
"right": "ArrowRight",
"left": "ArrowLeft",
"ctl": "Ctrl",
}

var display = map[string]string{
"Slash": "/",
"Backslash": "\\",
"LsqBracket": "[",
"RsqBracket": "]",
"Underscore": "_",
"Tilde": "~",
"Ctrl": "^",
}

var supportedKeybindings = map[string]gocui.Key{
"KeyF1": gocui.KeyF1,
"KeyF2": gocui.KeyF2,
"KeyF3": gocui.KeyF3,
"KeyF4": gocui.KeyF4,
"KeyF5": gocui.KeyF5,
"KeyF6": gocui.KeyF6,
"KeyF7": gocui.KeyF7,
"KeyF8": gocui.KeyF8,
"KeyF9": gocui.KeyF9,
"KeyF10": gocui.KeyF10,
"KeyF11": gocui.KeyF11,
"KeyF12": gocui.KeyF12,
"KeyInsert": gocui.KeyInsert,
"KeyDelete": gocui.KeyDelete,
"KeyHome": gocui.KeyHome,
"KeyEnd": gocui.KeyEnd,
"KeyPgup": gocui.KeyPgup,
"KeyPgdn": gocui.KeyPgdn,
"KeyArrowUp": gocui.KeyArrowUp,
"KeyArrowDown": gocui.KeyArrowDown,
"KeyArrowLeft": gocui.KeyArrowLeft,
"KeyArrowRight": gocui.KeyArrowRight,
"KeyCtrlTilde": gocui.KeyCtrlTilde,
"KeyCtrl2": gocui.KeyCtrl2,
"KeyCtrlSpace": gocui.KeyCtrlSpace,
"KeyCtrlA": gocui.KeyCtrlA,
"KeyCtrlB": gocui.KeyCtrlB,
"KeyCtrlC": gocui.KeyCtrlC,
"KeyCtrlD": gocui.KeyCtrlD,
"KeyCtrlE": gocui.KeyCtrlE,
"KeyCtrlF": gocui.KeyCtrlF,
"KeyCtrlG": gocui.KeyCtrlG,
"KeyBackspace": gocui.KeyBackspace,
"KeyCtrlH": gocui.KeyCtrlH,
"KeyTab": gocui.KeyTab,
"KeyCtrlI": gocui.KeyCtrlI,
"KeyCtrlJ": gocui.KeyCtrlJ,
"KeyCtrlK": gocui.KeyCtrlK,
"KeyCtrlL": gocui.KeyCtrlL,
"KeyEnter": gocui.KeyEnter,
"KeyCtrlM": gocui.KeyCtrlM,
"KeyCtrlN": gocui.KeyCtrlN,
"KeyCtrlO": gocui.KeyCtrlO,
"KeyCtrlP": gocui.KeyCtrlP,
"KeyCtrlQ": gocui.KeyCtrlQ,
"KeyCtrlR": gocui.KeyCtrlR,
"KeyCtrlS": gocui.KeyCtrlS,
"KeyCtrlT": gocui.KeyCtrlT,
"KeyCtrlU": gocui.KeyCtrlU,
"KeyCtrlV": gocui.KeyCtrlV,
"KeyCtrlW": gocui.KeyCtrlW,
"KeyCtrlX": gocui.KeyCtrlX,
"KeyCtrlY": gocui.KeyCtrlY,
"KeyCtrlZ": gocui.KeyCtrlZ,
"KeyEsc": gocui.KeyEsc,
"KeyCtrlLsqBracket": gocui.KeyCtrlLsqBracket,
"KeyCtrl3": gocui.KeyCtrl3,
"KeyCtrl4": gocui.KeyCtrl4,
"KeyCtrlBackslash": gocui.KeyCtrlBackslash,
"KeyCtrl5": gocui.KeyCtrl5,
"KeyCtrlRsqBracket": gocui.KeyCtrlRsqBracket,
"KeyCtrl6": gocui.KeyCtrl6,
"KeyCtrl7": gocui.KeyCtrl7,
"KeyCtrlSlash": gocui.KeyCtrlSlash,
"KeyCtrlUnderscore": gocui.KeyCtrlUnderscore,
"KeySpace": gocui.KeySpace,
"KeyBackspace2": gocui.KeyBackspace2,
"KeyCtrl8": gocui.KeyCtrl8,
}

type Key struct {
Value gocui.Key
Modifier gocui.Modifier
Tokens []string
}

func Parse(input string) (Key, error) {
f := func(c rune) bool { return unicode.IsSpace(c) || c == '+' }
tokens := strings.FieldsFunc(input, f)
var normalizedTokens []string
var modifier = gocui.ModNone

for _, token := range tokens {
normalized := strings.ToLower(token)

if value, exists := translate[normalized]; exists {
normalized = value
} else {
normalized = strings.Title(normalized)
}

if normalized == "Alt" {
modifier = gocui.ModAlt
continue
}

if len(normalized) == 1 {
normalizedTokens = append(normalizedTokens, strings.ToUpper(normalized))
continue
}

normalizedTokens = append(normalizedTokens, normalized)
}

lookup := "Key" + strings.Join(normalizedTokens, "")

if key, exists := supportedKeybindings[lookup]; exists {
return Key{key, modifier, normalizedTokens}, nil
}

if modifier != gocui.ModNone {
return Key{0, modifier, normalizedTokens}, fmt.Errorf("unsupported keybinding: %s (+%+v)", lookup, modifier)
}
return Key{0, modifier, normalizedTokens}, fmt.Errorf("unsupported keybinding: %s", lookup)
}

func ParseAll(input string) ([]Key, error) {
ret := make([]Key, 0)
for _, value := range strings.Split(input, ",") {
key, err := Parse(value)
if err != nil {
return nil, fmt.Errorf("could not parse keybinding '%s' from request '%s': %+v", value, input, err)
}
ret = append(ret, key)
}
if len(ret) == 0 {
return nil, fmt.Errorf("must have at least one keybinding")
}
return ret, nil
}

func (key Key) String() string {
displayTokens := make([]string, 0)
prefix := ""
for _, token := range key.Tokens {
if token == "Ctrl" {
prefix = "^"
continue
}
if value, exists := display[token]; exists {
token = value
}
displayTokens = append(displayTokens, token)
}
return prefix + strings.Join(displayTokens, "+")
}
Loading

0 comments on commit 5e9380d

Please sign in to comment.