diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-05 20:42:11 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-05 20:43:45 +1000 |
commit | 986774e5c7ddf5c1de1e1adb831baac84a2dae66 (patch) | |
tree | 63c0af0ec32cfd39615d8212bdc3a707e5e30d5b /vendor | |
parent | 98763e98cb4c0af033b5276423e451f1f8cd11ee (diff) |
add commit count via gocui subtitle
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/gui.go | 24 | ||||
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/view.go | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go index 26ba79bd6..4393c06c4 100644 --- a/vendor/github.com/jesseduffield/gocui/gui.go +++ b/vendor/github.com/jesseduffield/gocui/gui.go @@ -476,6 +476,11 @@ func (g *Gui) flush() error { return err } } + if v.Subtitle != "" { + if err := g.drawSubtitle(v, fgColor, bgColor); err != nil { + return err + } + } } if err := g.draw(v); err != nil { return err @@ -582,6 +587,25 @@ func (g *Gui) drawTitle(v *View, fgColor, bgColor Attribute) error { return nil } +// drawSubtitle draws the subtitle of the view. +func (g *Gui) drawSubtitle(v *View, fgColor, bgColor Attribute) error { + if v.y0 < 0 || v.y0 >= g.maxY { + return nil + } + + start := v.x1 - 5 - len(v.Subtitle) + for i, ch := range v.Subtitle { + x := start + i + if x >= v.x1 { + break + } + if err := g.SetRune(x, v.y0, ch, fgColor, bgColor); err != nil { + return err + } + } + return nil +} + // draw manages the cursor and calls the draw function of a view. func (g *Gui) draw(v *View) error { if g.Cursor { diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go index 0dd897aa4..53ab06f8c 100644 --- a/vendor/github.com/jesseduffield/gocui/view.go +++ b/vendor/github.com/jesseduffield/gocui/view.go @@ -77,6 +77,9 @@ type View struct { // If Frame is true, Title allows to configure a title for the view. Title string + // If Frame is true, Subtitle allows to configure a subtitle for the view. + Subtitle string + // If Mask is true, the View will display the mask instead of the real // content Mask rune |