Skip to content

Commit

Permalink
Fix alignment in table example
Browse files Browse the repository at this point in the history
  • Loading branch information
coloursofnoise committed Dec 3, 2021
1 parent 4cac2a8 commit c12d2bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _examples/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (t *Table) Layout(g *gocui.Gui) error {
width, height := view.Size()
hOffset := 0
for cid, column := range t.Columns {
size := int(float32(width) * column.Size)
size := int(float32(width+1) * column.Size)

view.SetWritePos(hOffset, 0)
view.WriteString(column.Title)
Expand All @@ -53,7 +53,7 @@ func (t *Table) Layout(g *gocui.Gui) error {
view.SetWritePos(hOffset, rid+1)
view.WriteString(t.Data[cid][rid])
}
view.SetWritePos(hOffset+size-3, rid)
view.SetWritePos(hOffset+size-1, rid)
view.WriteRunes([]rune{'│'})
}

Expand All @@ -70,7 +70,7 @@ func main() {
}
defer g.Close()

table := NewTable("t", 1, 2, 80, 10)
table := NewTable("t", 0, 2, 80, 10)
table.Columns = []Column{
{"Column1", 0.25},
{"Column2", 0.25},
Expand Down

0 comments on commit c12d2bc

Please sign in to comment.