aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-12 22:27:19 -0500
committerRobin Jarry <robin@jarry.cc>2024-02-14 23:20:46 +0100
commit2927516175b7d92f2b4a271cce05d0ded0302f8a (patch)
tree22a6c662bd5fbafeaf4b72f2ec66045e13f72054 /config
parent19d270886e3abc7468d21f11145d75974320f933 (diff)
downloadaerc-2927516175b7d92f2b4a271cce05d0ded0302f8a.tar.gz
binds: allow account and folder binds to coexist
When loading binds, account-specific binds are first applied, and then folder-specific binds are applied. However, in the process of merging the account-specific binds with the general binds, the folder-specific binds are lost. As a result, if both account- and folder-specific binds exist, the folder-specific binds will do nothing when in the specified account. The following minimal binds.conf reproduces this behavior: [messages] [messages:account=<ACCOUNT>] [messages:folder=<FOLDER>] q = :quit<Enter> Fix this issue by ensuring contextual binds are preserved when merging. Changelog-fixed: Allow account- and folder-specific binds to coexist. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config')
-rw-r--r--config/binds.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/config/binds.go b/config/binds.go
index c288864a..95fa8c7d 100644
--- a/config/binds.go
+++ b/config/binds.go
@@ -363,6 +363,12 @@ func MergeBindings(bindings ...*KeyBindings) *KeyBindings {
merged.ExKey = bindings[0].ExKey
merged.CompleteKey = bindings[0].CompleteKey
merged.Globals = bindings[0].Globals
+ for _, b := range bindings {
+ merged.contextualBinds = append(merged.contextualBinds, b.contextualBinds...)
+ for t, c := range b.contextualCounts {
+ merged.contextualCounts[t] += c
+ }
+ }
return merged
}