mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
termui: help bar background goes all the width
This commit is contained in:
parent
9ce84fc1a3
commit
8eb7faf67c
@ -128,7 +128,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
|
||||
v.Frame = false
|
||||
v.FgColor = gocui.ColorWhite
|
||||
|
||||
_, _ = fmt.Fprint(v, bugTableHelp.Render())
|
||||
_, _ = fmt.Fprint(v, bugTableHelp.Render(maxX))
|
||||
}
|
||||
|
||||
_, err = g.SetCurrentView(bugTableView)
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
text "github.com/MichaelMure/go-term-text"
|
||||
|
||||
"github.com/MichaelMure/git-bug/util/colors"
|
||||
)
|
||||
|
||||
@ -12,13 +14,17 @@ type helpBar []struct {
|
||||
text string
|
||||
}
|
||||
|
||||
func (hb helpBar) Render() string {
|
||||
func (hb helpBar) Render(maxX int) string {
|
||||
var builder strings.Builder
|
||||
for i, entry := range hb {
|
||||
if i != 0 {
|
||||
builder.WriteByte(' ')
|
||||
}
|
||||
for _, entry := range hb {
|
||||
builder.WriteString(colors.BlueBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text)))
|
||||
builder.WriteByte(' ')
|
||||
}
|
||||
|
||||
l := text.Len(builder.String())
|
||||
if l < maxX {
|
||||
builder.WriteString(colors.BlueBg(strings.Repeat(" ", maxX-l)))
|
||||
}
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error {
|
||||
v.FgColor = gocui.ColorWhite
|
||||
}
|
||||
v.Clear()
|
||||
_, _ = fmt.Fprint(v, labelSelectHelp.Render())
|
||||
_, _ = fmt.Fprint(v, labelSelectHelp.Render(maxX))
|
||||
if _, err = g.SetViewOnTop(labelSelectInstructionsView); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ func (sb *showBug) layout(g *gocui.Gui) error {
|
||||
}
|
||||
|
||||
v.Clear()
|
||||
_, _ = fmt.Fprint(v, showBugHelp.Render())
|
||||
_, _ = fmt.Fprint(v, showBugHelp.Render(maxX))
|
||||
|
||||
_, err = g.SetViewOnTop(showBugInstructionView)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user