gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Resize not working on iTerm2 #130

Closed arxdsilva closed 7 years ago

arxdsilva commented 7 years ago

Before resizing: screen shot 2017-03-08 at 2 16 43 pm after: screen shot 2017-03-08 at 2 12 55 pm

source code:

package main

import "github.com/gizak/termui"

const height = 11

func main() {
    err := termui.Init()
    if err != nil {
        panic(err)
    }
    defer termui.Close()
    termui.Handle("/sys/kbd/q", func(termui.Event) {
        termui.StopLoop()
    })
    rows1 := [][]string{
        []string{"#", "app-list"},
        []string{"1", "tsuru"},
        []string{"2", "globoplay"},
        []string{"3", "ge"},
        []string{"4", "neymar"},
    }
    par1 := termui.NewPar("arthur.silva@corp.globo.com")
    par1.Height = 3
    par1.BorderLabel = "user"
    rows0 := [][]string{
        []string{"target", "set"},
        []string{"dev", "*"},
        []string{"qa", ""},
        []string{"qa02", ""},
        []string{"prod", ""},
    }
    table0 := termui.NewTable()
    table0.Rows = rows0
    table0.FgColor = termui.ColorWhite
    table0.BgColor = termui.ColorDefault
    table0.Height = height
    table1 := termui.NewTable()
    table1.Rows = rows1
    table1.FgColor = termui.ColorWhite
    table1.BgColor = termui.ColorDefault
    table1.Width = 20
    table1.Height = height
    bc := termui.NewBarChart()
    data := []int{5, 12, 25, 7}
    bclabels := []string{"#1", "#2", "#3", "#4"}
    bc.BorderLabel = "Units"
    bc.Data = data
    bc.Height = height
    bc.DataLabels = bclabels
    bc.TextColor = termui.ColorGreen
    bc.BarColor = termui.ColorRed
    bc.NumColor = termui.ColorYellow
    termui.Body.AddRows(
        termui.NewRow(
            termui.NewCol(3, 0, par1),
            termui.NewCol(3, 0, table0),
            termui.NewCol(3, 0, table1),
            termui.NewCol(3, 0, bc),
        ),
    )
    termui.Body.Align()
    termui.Render(table1, par1, bc, table0)
    termui.Loop()
}
gizak commented 7 years ago

Did you try _example/grid.go? Is it working on your terminal?

arxdsilva commented 7 years ago

Well, turns out that I've forgotten to add the handler :), btw after doing It I still got some visual bug:

screen shot 2017-03-08 at 9 59 13 pm