1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

more standardising modes

This commit is contained in:
Jesse Duffield
2020-08-23 09:23:59 +10:00
parent 88ae550b93
commit b3a7acbdad
3 changed files with 32 additions and 22 deletions

View File

@ -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")
}