diff options
author | Michael Muré <batolettre@gmail.com> | 2020-08-30 12:17:04 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-08-30 12:17:04 +0200 |
commit | 807844bbec89b71f5334376ab0048cb019433138 (patch) | |
tree | 2511678dd3677b53832395c2aa30b8f4d8f8ce85 /termui | |
parent | a42abaaed74fb927da903d746ecf66381ce2ee8b (diff) | |
download | git-bug-807844bbec89b71f5334376ab0048cb019433138.tar.gz |
termui: don't pack it *that* much
Diffstat (limited to 'termui')
-rw-r--r-- | termui/bug_table.go | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go index c589d337..b8f20b76 100644 --- a/termui/bug_table.go +++ b/termui/bug_table.go @@ -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 { |