aboutsummaryrefslogtreecommitdiffstats
path: root/config/bindings.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-08-08 22:04:04 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-22 09:30:37 +0200
commit5c8a749cfa97b3ad9184f0f80a7d5c7921e8c073 (patch)
treec54468ed058024138b37fdada9e98ac0459fcd85 /config/bindings.go
parente31dbe9f3138f9576a48bc1fbc3a018e833ee0db (diff)
downloadaerc-5c8a749cfa97b3ad9184f0f80a7d5c7921e8c073.tar.gz
binds: display active keybinds in a dialog box
Show contextual keybinds in a textbox when using the ':help keys' command. This command is bound to '?' by default. Fixes: https://todo.sr.ht/~rjarry/aerc/42 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/bindings.go')
-rw-r--r--config/bindings.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/config/bindings.go b/config/bindings.go
index 15c2ce31..18a872b0 100644
--- a/config/bindings.go
+++ b/config/bindings.go
@@ -22,7 +22,7 @@ type Binding struct {
}
type KeyBindings struct {
- bindings []*Binding
+ Bindings []*Binding
// If false, disable global keybindings in this context
Globals bool
@@ -48,7 +48,7 @@ func NewKeyBindings() *KeyBindings {
func MergeBindings(bindings ...*KeyBindings) *KeyBindings {
merged := NewKeyBindings()
for _, b := range bindings {
- merged.bindings = append(merged.bindings, b.bindings...)
+ merged.Bindings = append(merged.Bindings, b.Bindings...)
}
merged.ExKey = bindings[0].ExKey
merged.Globals = bindings[0].Globals
@@ -79,7 +79,7 @@ func (config AercConfig) MergeContextualBinds(baseBinds *KeyBindings,
func (bindings *KeyBindings) Add(binding *Binding) {
// TODO: Search for conflicts?
- bindings.bindings = append(bindings.bindings, binding)
+ bindings.Bindings = append(bindings.Bindings, binding)
}
func (bindings *KeyBindings) GetBinding(
@@ -88,7 +88,7 @@ func (bindings *KeyBindings) GetBinding(
incomplete := false
// TODO: This could probably be a sorted list to speed things up
// TODO: Deal with bindings that share a prefix
- for _, binding := range bindings.bindings {
+ for _, binding := range bindings.Bindings {
if len(binding.Input) < len(input) {
continue
}
@@ -121,7 +121,7 @@ func (bindings *KeyBindings) GetBinding(
func (bindings *KeyBindings) GetReverseBindings(output []KeyStroke) [][]KeyStroke {
var inputs [][]KeyStroke
- for _, binding := range bindings.bindings {
+ for _, binding := range bindings.Bindings {
if len(binding.Output) != len(output) {
continue
}