Make losing focus on Confirmations count as closing them #4277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will fix #4052 where new users click out of the panel, but the state never gets updated.
It makes sense to do this as a close and not a confirm, because losing focus could be due to many things, and doesn't indicate an explicit confirmation.
It is up to the implementation of the initial popup message that a cancelling or closing should mean they don't see it again. Most popups don't have a meaningful
ConfirmOpts.OnClose
method, so this change will be a no-op for them.The helper that creates the
OnClose
method I call here should ensure that it is notnil
in normal operations, but I fear there could be some moment where it ends up as nil, so I'm guarding against that.Here is a list of potentially impacted closing methods. The only one I worry about a little bit because I am unfamiliar with its section of code is the CredentialsHelper.
Introductory Message (what the issue was reported on):
lazygit/pkg/gui/gui.go
Lines 1008 to 1020 in 01eece3
Breaking Changes Message
lazygit/pkg/gui/gui.go
Lines 1077 to 1087 in 01eece3
CredentialsHelper
lazygit/pkg/gui/controllers/helpers/credentials_helper.go
Lines 38 to 42 in 01eece3
Fixes #4052
go generate ./...
)