From 2927516175b7d92f2b4a271cce05d0ded0302f8a Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Mon, 12 Feb 2024 22:27:19 -0500 Subject: 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=] [messages:folder=] q = :quit 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 Acked-by: Robin Jarry --- config/binds.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config') 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 } -- cgit