From 079c5a990547061b54d9a485a30b97fc016edcc3 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 27 Aug 2024 09:52:03 +0200 Subject: [PATCH] Add prefix to main view diff when in diffing mode Hopefully this will help alleviate the problem that diffing mode is sticky, and you often forget that it's still on. Make it magenta like the mode text in the information view. --- pkg/gui/controllers/helpers/diff_helper.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/gui/controllers/helpers/diff_helper.go b/pkg/gui/controllers/helpers/diff_helper.go index 94ac291b9..a80fb0292 100644 --- a/pkg/gui/controllers/helpers/diff_helper.go +++ b/pkg/gui/controllers/helpers/diff_helper.go @@ -1,9 +1,12 @@ package helpers import ( + "strings" + "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/modes/diffing" + "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/samber/lo" ) @@ -52,8 +55,14 @@ func (self *DiffHelper) ExitDiffMode() error { } func (self *DiffHelper) RenderDiff() error { - cmdObj := self.c.Git().Diff.DiffCmdObj(self.DiffArgs()) + args := self.DiffArgs() + cmdObj := self.c.Git().Diff.DiffCmdObj(args) task := types.NewRunPtyTask(cmdObj.GetCmd()) + task.Prefix = style.FgMagenta.Sprintf( + "%s %s\n\n", + self.c.Tr.ShowingGitDiff, + "git diff "+strings.Join(args, " "), + ) return self.c.RenderToMainViews(types.RefreshMainOpts{ Pair: self.c.MainViewPairs().Normal,