1package gui 2 3import ( 4 "fmt" 5 6 "github.com/jesseduffield/lazygit/pkg/constants" 7 "github.com/jesseduffield/lazygit/pkg/gui/style" 8) 9 10func (gui *Gui) informationStr() string { 11 for _, mode := range gui.modeStatuses() { 12 if mode.isActive() { 13 return mode.description() 14 } 15 } 16 17 if gui.g.Mouse { 18 donate := style.FgMagenta.SetUnderline().Sprint(gui.Tr.Donate) 19 askQuestion := style.FgYellow.SetUnderline().Sprint(gui.Tr.AskQuestion) 20 return fmt.Sprintf("%s %s %s", donate, askQuestion, gui.Config.GetVersion()) 21 } else { 22 return gui.Config.GetVersion() 23 } 24} 25 26func (gui *Gui) handleInfoClick() error { 27 if !gui.g.Mouse { 28 return nil 29 } 30 31 view := gui.Views.Information 32 33 cx, _ := view.Cursor() 34 width, _ := view.Size() 35 36 for _, mode := range gui.modeStatuses() { 37 if mode.isActive() { 38 if width-cx > len(gui.Tr.ResetInParentheses) { 39 return nil 40 } 41 return mode.reset() 42 } 43 } 44 45 // if we're not in an active mode we show the donate button 46 if cx <= len(gui.Tr.Donate) { 47 return gui.OSCommand.OpenLink(constants.Links.Donate) 48 } else if cx <= len(gui.Tr.Donate)+1+len(gui.Tr.AskQuestion) { 49 return gui.OSCommand.OpenLink(constants.Links.Discussions) 50 } 51 return nil 52} 53