From 3b264806ef14dcdddaa429acc2bcc10cc37cd9cb Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 8 Aug 2018 08:32:52 +1000 Subject: [PATCH] add version number --- gui.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gui.go b/gui.go index 7c5344dd8..5ff2eeeb2 100644 --- a/gui.go +++ b/gui.go @@ -16,6 +16,9 @@ import ( "github.com/jesseduffield/gocui" ) +// Rev is the release version +var Rev string + // OverlappingEdges determines if panel edges overlap var OverlappingEdges = false @@ -225,14 +228,28 @@ func layout(g *gocui.Gui) error { v.FgColor = gocui.ColorWhite } - if v, err := g.SetView("options", -1, optionsTop, width, optionsTop+2, 0); err != nil { + version := Rev + if version == "" { + version = "unversioned" + } + + if v, err := g.SetView("options", -1, optionsTop, width-len(version)-2, optionsTop+2, 0); err != nil { if err != gocui.ErrUnknownView { return err } v.BgColor = gocui.ColorDefault v.FgColor = gocui.ColorBlue v.Frame = false - v.Title = "Options" + } + + if v, err := g.SetView("version", width-len(version)-1, optionsTop, width, optionsTop+2, 0); err != nil { + if err != gocui.ErrUnknownView { + return err + } + v.BgColor = gocui.ColorDefault + v.FgColor = gocui.ColorGreen + v.Frame = false + renderString(g, "version", version) // these are only called once handleFileSelect(g, filesView)