Beispiel #1
0
// Init initializes termui library. This function should be called before any others.
// After initialization, the library must be finalized by 'Close' function.
func Init() error {
	Body = NewGrid()
	Body.X = 0
	Body.Y = 0
	Body.BgColor = theme.BodyBg
	defer func() {
		w, _ := tm.Size()
		Body.Width = w
		evtListen()
	}()
	return tm.Init()
}
Beispiel #2
0
// TermHeight returns the current terminal's height.
func TermHeight() int {
	tm.Sync()
	_, h := tm.Size()
	return h
}
Beispiel #3
0
// TermWidth returns the current terminal's width.
func TermWidth() int {
	tm.Sync()
	w, _ := tm.Size()
	return w
}