aboutsummaryrefslogtreecommitdiffstats
path: root/config/bindings.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-10-25 15:20:34 +0200
committerRobin Jarry <robin@jarry.cc>2021-10-28 16:22:28 +0200
commit1a75906bcbc1915a696259f20373a5a78d4ef8a3 (patch)
treefd674341c9c41ef20604acee89977f1d52e32c18 /config/bindings.go
parent7a6c808c042bf6f662e6d6b6dba09829a1f9ed15 (diff)
downloadaerc-1a75906bcbc1915a696259f20373a5a78d4ef8a3.tar.gz
bindings: support more modified keys
Add new supported keys: Ctrl+Enter Ctrl+Up Ctrl+Down Ctrl+Left Ctrl+Right Ctrl+PageUp Ctrl+PageDown Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/bindings.go')
-rw-r--r--config/bindings.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/config/bindings.go b/config/bindings.go
index f517c736..eff48a61 100644
--- a/config/bindings.go
+++ b/config/bindings.go
@@ -12,8 +12,8 @@ import (
type KeyStroke struct {
Modifiers tcell.ModMask
- Key tcell.Key
- Rune rune
+ Key tcell.Key
+ Rune rune
}
type Binding struct {
@@ -133,8 +133,8 @@ func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) {
default:
strokes = append(strokes, KeyStroke{
Modifiers: tcell.ModNone,
- Key: tcell.KeyRune,
- Rune: tok,
+ Key: tcell.KeyRune,
+ Rune: tok,
})
}
}
@@ -161,17 +161,24 @@ func init() {
keyNames["space"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ' '}
keyNames["semicolon"] = KeyStroke{tcell.ModNone, tcell.KeyRune, ';'}
keyNames["enter"] = KeyStroke{tcell.ModNone, tcell.KeyEnter, 0}
+ keyNames["c-enter"] = KeyStroke{tcell.ModCtrl, tcell.KeyEnter, 0}
keyNames["up"] = KeyStroke{tcell.ModNone, tcell.KeyUp, 0}
+ keyNames["c-up"] = KeyStroke{tcell.ModCtrl, tcell.KeyUp, 0}
keyNames["down"] = KeyStroke{tcell.ModNone, tcell.KeyDown, 0}
+ keyNames["c-down"] = KeyStroke{tcell.ModCtrl, tcell.KeyDown, 0}
keyNames["right"] = KeyStroke{tcell.ModNone, tcell.KeyRight, 0}
+ keyNames["c-right"] = KeyStroke{tcell.ModCtrl, tcell.KeyRight, 0}
keyNames["left"] = KeyStroke{tcell.ModNone, tcell.KeyLeft, 0}
+ keyNames["c-left"] = KeyStroke{tcell.ModCtrl, tcell.KeyLeft, 0}
keyNames["upleft"] = KeyStroke{tcell.ModNone, tcell.KeyUpLeft, 0}
keyNames["upright"] = KeyStroke{tcell.ModNone, tcell.KeyUpRight, 0}
keyNames["downleft"] = KeyStroke{tcell.ModNone, tcell.KeyDownLeft, 0}
keyNames["downright"] = KeyStroke{tcell.ModNone, tcell.KeyDownRight, 0}
keyNames["center"] = KeyStroke{tcell.ModNone, tcell.KeyCenter, 0}
keyNames["pgup"] = KeyStroke{tcell.ModNone, tcell.KeyPgUp, 0}
+ keyNames["c-pgup"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgUp, 0}
keyNames["pgdn"] = KeyStroke{tcell.ModNone, tcell.KeyPgDn, 0}
+ keyNames["c-pgdn"] = KeyStroke{tcell.ModCtrl, tcell.KeyPgDn, 0}
keyNames["home"] = KeyStroke{tcell.ModNone, tcell.KeyHome, 0}
keyNames["end"] = KeyStroke{tcell.ModNone, tcell.KeyEnd, 0}
keyNames["insert"] = KeyStroke{tcell.ModNone, tcell.KeyInsert, 0}