mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-23 22:24:51 +02:00
Allow more than one controller to attach OnFocus/OnFocusLost functions
Trying to do this would previously have the second one silently overwrite the first one's. We don't currently have this in lazygit, but I ran into the situation once during development, and it can lead to bugs that are hard to diagnose. Instead of holding a list of functions, we could also have added a panic in case the function was set already; this would have been good enough for the current state, and enough to catch mistakes early in the future. However, I decided to allow multiple controllers to attach these functions, because I can't see a reason not to.
This commit is contained in:
@@ -88,7 +88,7 @@ type IBaseContext interface {
|
||||
|
||||
AddKeybindingsFn(KeybindingsFn)
|
||||
AddMouseKeybindingsFn(MouseKeybindingsFn)
|
||||
ClearAllBindingsFn()
|
||||
ClearAllAttachedControllerFunctions()
|
||||
|
||||
// This is a bit of a hack at the moment: we currently only set an onclick function so that
|
||||
// our list controller can come along and wrap it in a list-specific click handler.
|
||||
|
||||
Reference in New Issue
Block a user