diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 09:23:59 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | b3a7acbdad7d11df12fce95aff8aa95eff7d0d6a (patch) | |
tree | 400f9a497fdb2eb83551d0e8df917f054fffd6a4 /pkg/gui/global_handlers.go | |
parent | 88ae550b93020de7e4b232b3ed9a26606c7caa83 (diff) |
more standardising modes
Diffstat (limited to 'pkg/gui/global_handlers.go')
-rw-r--r-- | pkg/gui/global_handlers.go | 20 |
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") } |