1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-08 04:01:59 +03:00

add commit count via gocui subtitle

This commit is contained in:
Jesse Duffield
2018-09-05 20:42:11 +10:00
parent 98763e98cb
commit 986774e5c7
7 changed files with 64 additions and 86 deletions

View File

@ -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 {