mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-13 05:15:53 +02:00
add commit count via gocui subtitle
This commit is contained in:
parent
98763e98cb
commit
986774e5c7
7 changed files with 64 additions and 86 deletions
24
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
24
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
|
@ -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 {
|
||||
|
|
3
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
3
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue