summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-11 21:52:04 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-11 22:07:29 +1000
commit84b0c3df4fd8373dcc248a907ddb3c539a88f0c7 (patch)
tree180d6b62944697fa61336092fc586cab55e69dfa
parent764bd556f3500bf51556e8f475d5efdda7fd9c46 (diff)
ask question button
-rw-r--r--pkg/gui/arrangement.go2
-rw-r--r--pkg/gui/global_handlers.go26
-rw-r--r--pkg/gui/information_panel.go51
-rw-r--r--pkg/gui/layout.go17
-rw-r--r--pkg/i18n/english.go2
5 files changed, 55 insertions, 43 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go
index 93e49fe46..f5fd02d23 100644
--- a/pkg/gui/arrangement.go
+++ b/pkg/gui/arrangement.go
@@ -5,6 +5,8 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
+const INFO_SECTION_PADDING = " "
+
func (gui *Gui) mainSectionChildren() []*boxlayout.Box {
currentWindow := gui.currentWindow()
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index eee09a546..6e098fb6c 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -187,32 +187,6 @@ func (gui *Gui) handleMouseDownSecondary() error {
return nil
}
-func (gui *Gui) handleInfoClick() error {
- if !gui.g.Mouse {
- return nil
- }
-
- view := gui.Views.Information
-
- cx, _ := view.Cursor()
- width, _ := view.Size()
-
- for _, mode := range gui.modeStatuses() {
- if mode.isActive() {
- if width-cx > len(gui.Tr.ResetInParentheses) {
- return nil
- }
- return mode.reset()
- }
- }
-
- // if we're not in an active mode we show the donate button
- if cx <= len(gui.Tr.Donate)+len(INFO_SECTION_PADDING) {
- return gui.OSCommand.OpenLink("https://github.com/sponsors/jesseduffield")
- }
- return nil
-}
-
func (gui *Gui) fetch(canPromptForCredentials bool, span string) (err error) {
gui.Mutexes.FetchMutex.Lock()
defer gui.Mutexes.FetchMutex.Unlock()
diff --git a/pkg/gui/information_panel.go b/pkg/gui/information_panel.go
new file mode 100644
index 000000000..10292026d
--- /dev/null
+++ b/pkg/gui/information_panel.go
@@ -0,0 +1,51 @@
+package gui
+
+import (
+ "fmt"
+
+ "github.com/fatih/color"
+)
+
+func (gui *Gui) informationStr() string {
+ for _, mode := range gui.modeStatuses() {
+ if mode.isActive() {
+ return mode.description()
+ }
+ }
+
+ if gui.g.Mouse {
+ donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.Donate)
+ askQuestion := color.New(color.FgYellow, color.Underline).Sprint(gui.Tr.AskQuestion)
+ return fmt.Sprintf("%s %s %s", donate, askQuestion, gui.Config.GetVersion())
+ } else {
+ return gui.Config.GetVersion()
+ }
+}
+
+func (gui *Gui) handleInfoClick() error {
+ if !gui.g.Mouse {
+ return nil
+ }
+
+ view := gui.Views.Information
+
+ cx, _ := view.Cursor()
+ width, _ := view.Size()
+
+ for _, mode := range gui.modeStatuses() {
+ if mode.isActive() {
+ if width-cx > len(gui.Tr.ResetInParentheses) {
+ return nil
+ }
+ return mode.reset()
+ }
+ }
+
+ // if we're not in an active mode we show the donate button
+ if cx <= len(gui.Tr.Donate) {
+ return gui.OSCommand.OpenLink("https://github.com/sponsors/jesseduffield")
+ } else if cx <= len(gui.Tr.Donate)+1+len(gui.Tr.AskQuestion) {
+ return gui.OSCommand.OpenLink("https://github.com/jesseduffield/lazygit/discussions")
+ }
+ return nil
+}
diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go
index 9846e67ef..07ffb2814 100644
--- a/pkg/gui/layout.go
+++ b/pkg/gui/layout.go
@@ -1,28 +1,11 @@
package gui
import (
- "github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/theme"
)
const SEARCH_PREFIX = "search: "
-const INFO_SECTION_PADDING = " "
-
-func (gui *Gui) informationStr() string {
- for _, mode := range gui.modeStatuses() {
- if mode.isActive() {
- return mode.description()
- }
- }
-
- if gui.g.Mouse {
- donate := color.New(color.FgMagenta, color.Underline).Sprint(gui.Tr.Donate)
- return donate + " " + gui.Config.GetVersion()
- } else {
- return gui.Config.GetVersion()
- }
-}
func (gui *Gui) createAllViews() error {
viewNameMappings := []struct {
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index 97791f014..98c219620 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -233,6 +233,7 @@ type TranslationSet struct {
CannotRebaseOntoFirstCommit string
CannotSquashOntoSecondCommit string
Donate string
+ AskQuestion string
PrevLine string
NextLine string
PrevHunk string
@@ -888,6 +889,7 @@ func englishTranslationSet() TranslationSet {
CannotRebaseOntoFirstCommit: "You cannot interactive rebase onto the first commit",
CannotSquashOntoSecondCommit: "You cannot squash/fixup onto the second commit",
Donate: "Donate",
+ AskQuestion: "Ask Question",
PrevLine: "select previous line",
NextLine: "select next line",
PrevHunk: "select previous hunk",