From 41df63cdc4d799ce7d78ecb0b1ed96dea65f1739 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 21 Aug 2020 21:17:09 +1000 Subject: [PATCH] show when building patch --- pkg/gui/global_handlers.go | 19 ++++++++----------- pkg/gui/layout.go | 2 ++ pkg/i18n/english.go | 3 +++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go index 41c4895ff..ee44a3c48 100644 --- a/pkg/gui/global_handlers.go +++ b/pkg/gui/global_handlers.go @@ -142,21 +142,18 @@ func (gui *Gui) handleInfoClick(g *gocui.Gui, v *gocui.View) error { width, _ := v.Size() // if we're in the normal context there will be a donate button here - // if we have ('reset') at the end then - if gui.inFilterMode() { - if width-cx <= len(gui.Tr.SLocalize("(reset)")) { + if width-cx <= len(gui.Tr.SLocalize("(reset)")) { + if gui.inFilterMode() { return gui.exitFilterMode() - } else { - return nil } - } - - if gui.inDiffMode() { - if width-cx <= len(gui.Tr.SLocalize("(reset)")) { + if gui.inDiffMode() { return gui.exitDiffMode() - } else { - return nil } + if gui.GitCommand.PatchManager.Active() { + return gui.handleResetPatch() + } + } else { + return nil } if cx <= len(gui.Tr.SLocalize("Donate"))+len(INFO_SECTION_PADDING) { diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 266bb278c..cebda6375 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -17,6 +17,8 @@ func (gui *Gui) informationStr() string { return utils.ColoredString(fmt.Sprintf("%s %s %s", gui.Tr.SLocalize("showingGitDiff"), "git diff "+gui.diffStr(), utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgMagenta) } else if gui.inFilterMode() { return utils.ColoredString(fmt.Sprintf("%s '%s' %s", gui.Tr.SLocalize("filteringBy"), gui.State.FilterPath, utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgRed, color.Bold) + } else if gui.GitCommand.PatchManager.Active() { + return utils.ColoredString(fmt.Sprintf("%s %s", gui.Tr.SLocalize("buildingPatch"), utils.ColoredString(gui.Tr.SLocalize("(reset)"), color.Underline)), color.FgYellow, color.Bold) } else if len(gui.State.CherryPickedCommits) > 0 { return utils.ColoredString(fmt.Sprintf("%d commits copied", len(gui.State.CherryPickedCommits)), color.FgCyan) } else if gui.g.Mouse { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 4df273a71..fb4356139 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1170,6 +1170,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "viewStashFiles", Other: "view stash entry's files", + }, &i18n.Message{ + ID: "buildingPatch", + Other: "building patch", }, ) }