termui: fix a pagination off by one

This commit is contained in:
Michael Muré 2018-07-31 22:30:50 +02:00
parent 6b012b1e48
commit 2f88c28c59
No known key found for this signature in database
GPG Key ID: A4457C029293126F

View File

@ -45,7 +45,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
v.Clear()
bt.renderHeader(v, maxX)
v, err = g.SetView(bugTableView, -1, 1, maxX, maxY-2)
v, err = g.SetView(bugTableView, -1, 1, maxX, maxY-3)
if err != nil {
if err != gocui.ErrUnknownView {
@ -59,7 +59,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
}
_, viewHeight := v.Size()
err = bt.paginate(viewHeight - 1)
err = bt.paginate(viewHeight)
if err != nil {
return err
}
@ -72,7 +72,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error {
v.Clear()
bt.render(v, maxX)
v, err = g.SetView("footer", -1, maxY-3, maxX, maxY)
v, err = g.SetView("footer", -1, maxY-4, maxX, maxY)
if err != nil {
if err != gocui.ErrUnknownView {
@ -263,7 +263,7 @@ 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.bugs), len(bt.allIds))
fmt.Fprintf(v, " \nShowing %d of %d bugs", len(bt.bugs), len(bt.allIds))
}
func (bt *bugTable) cursorDown(g *gocui.Gui, v *gocui.View) error {