summaryrefslogtreecommitdiffstats
path: root/pkg/gui/global_handlers.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-23 09:23:59 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commitb3a7acbdad7d11df12fce95aff8aa95eff7d0d6a (patch)
tree400f9a497fdb2eb83551d0e8df917f054fffd6a4 /pkg/gui/global_handlers.go
parent88ae550b93020de7e4b232b3ed9a26606c7caa83 (diff)
more standardising modes
Diffstat (limited to 'pkg/gui/global_handlers.go')
-rw-r--r--pkg/gui/global_handlers.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index 574efdc6d..ce75c6162 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -141,21 +141,17 @@ func (gui *Gui) handleInfoClick(g *gocui.Gui, v *gocui.View) error {
cx, _ := v.Cursor()
width, _ := v.Size()
- // if we're in the normal context there will be a donate button here
- if width-cx <= len(gui.Tr.SLocalize("(reset)")) {
- if gui.State.Modes.Filtering.Active() {
- return gui.exitFilterMode()
- }
- if gui.State.Modes.Diffing.Active() {
- return gui.exitDiffMode()
- }
- if gui.GitCommand.PatchManager.Active() {
- return gui.handleResetPatch()
- }
- } else {
+ if width-cx > len(gui.Tr.SLocalize("(reset)")) {
return nil
}
+ for _, mode := range gui.modeStatuses() {
+ if mode.isActive() {
+ return mode.reset()
+ }
+ }
+
+ // if we're not in an active mode we show the donate button
if cx <= len(gui.Tr.SLocalize("Donate"))+len(INFO_SECTION_PADDING) {
return gui.OSCommand.OpenLink("https://github.com/sponsors/jesseduffield")
}