termui: don't pack it *that* much

This commit is contained in:
Michael Muré 2020-08-30 12:17:04 +02:00
parent a42abaaed7
commit 807844bbec
No known key found for this signature in database
GPG Key ID: A4457C029293126F

View File

@ -79,7 +79,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
v.Clear()
bt.renderHeader(v, maxX)
v, err = g.SetView(bugTableView, -1, 0, maxX, maxY-2, 0)
v, err = g.SetView(bugTableView, -1, 0, maxX, maxY-3, 0)
if err != nil {
if !gocui.IsUnknownView(err) {
@ -105,7 +105,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
v.Clear()
bt.render(v, viewWidth)
v, err = g.SetView(bugTableFooterView, -1, maxY-3, maxX, maxY, 0)
v, err = g.SetView(bugTableFooterView, -1, maxY-4, maxX, maxY, 0)
if err != nil {
if !gocui.IsUnknownView(err) {
@ -127,9 +127,9 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
v.Frame = false
v.FgColor = gocui.ColorWhite
_, _ = fmt.Fprint(v, bugTableHelp.Render(maxX))
}
v.Clear()
bt.renderHelp(v, maxX)
_, err = g.SetCurrentView(bugTableView)
return err
@ -306,14 +306,12 @@ func (bt *bugTable) render(v *gocui.View, maxX int) {
}
var labelsTxt strings.Builder
if len(excerpt.Labels) > 0 {
for _, l := range excerpt.Labels {
labelsTxt.WriteString(" ")
for _, l := range excerpt.Labels {
lc256 := l.Color().Term256()
labelsTxt.WriteString(lc256.Escape())
labelsTxt.WriteString("◼")
labelsTxt.WriteString(lc256.Unescape())
}
lc256 := l.Color().Term256()
labelsTxt.WriteString(lc256.Escape())
labelsTxt.WriteString("◼")
labelsTxt.WriteString(lc256.Unescape())
}
var authorDisplayName string
@ -365,7 +363,11 @@ func (bt *bugTable) renderHeader(v *gocui.View, maxX int) {
}
func (bt *bugTable) renderFooter(v *gocui.View, maxX int) {
_, _ = fmt.Fprintf(v, " Showing %d of %d bugs", len(bt.excerpts), len(bt.allIds))
_, _ = fmt.Fprintf(v, " \nShowing %d of %d bugs", len(bt.excerpts), len(bt.allIds))
}
func (bt *bugTable) renderHelp(v *gocui.View, maxX int) {
_, _ = fmt.Fprint(v, bugTableHelp.Render(maxX))
}
func (bt *bugTable) cursorDown(g *gocui.Gui, v *gocui.View) error {