summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-20 20:54:23 +1000
committerGitHub <noreply@github.com>2018-08-20 20:54:23 +1000
commit2aa89ade0dff22658c7a550213f5d4b7c4eeb229 (patch)
tree0c6dddfb3ad27361f7f9bc8efa37442ec164a8c5
parent8364509d1f91d470bfd5ddb388c8c4587ad88b44 (diff)
parent37029f7db3678f6659589e9ed983eea381e037bc (diff)
Merge pull request #195 from jesseduffield/hotfix/194-support-empty-versionv0.1.76
194: Support empty version string
-rw-r--r--pkg/gui/gui.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 1e7b6156b..66777b3a6 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -141,14 +141,15 @@ func max(a, b int) int {
func (gui *Gui) layout(g *gocui.Gui) error {
g.Highlight = true
width, height := g.Size()
+ version := gui.Config.GetVersion()
leftSideWidth := width / 3
statusFilesBoundary := 2
filesBranchesBoundary := 2 * height / 5 // height - 20
commitsBranchesBoundary := 3 * height / 5 // height - 10
commitsStashBoundary := height - 5 // height - 5
+ optionsVersionBoundary := width - max(len(version), 1)
minimumHeight := 16
minimumWidth := 10
- version := gui.Config.GetVersion()
panelSpacing := 1
if OverlappingEdges {
@@ -227,7 +228,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
v.FgColor = gocui.ColorWhite
}
- if v, err := g.SetView("options", -1, optionsTop, width-len(version)-2, optionsTop+2, 0); err != nil {
+ if v, err := g.SetView("options", -1, optionsTop, optionsVersionBoundary-1, optionsTop+2, 0); err != nil {
if err != gocui.ErrUnknownView {
return err
}
@@ -249,8 +250,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
commitMessageView.Editable = true
}
}
-
- if v, err := g.SetView("version", width-len(version)-1, optionsTop, width, optionsTop+2, 0); err != nil {
+ if v, err := g.SetView("version", optionsVersionBoundary-1, optionsTop, width, optionsTop+2, 0); err != nil {
if err != gocui.ErrUnknownView {
return err
}