in serverui.go [70:138]
func initServerTuiInternal() error {
err := tm.Init()
if err != nil {
return err
}
w, h := tm.Size()
if h < 40 || w < 80 {
tm.Close()
s := fmt.Sprintf("Terminal too small (%dwx%dh), must be at least 40hx80w", w, h)
return errors.New(s)
}
tm.SetInputMode(tm.InputEsc | tm.InputMouse)
tm.Clear(tm.ColorDefault, tm.ColorDefault)
tm.Sync()
tm.Flush()
hideCursor()
blockWindowResize()
tui := &serverTui{}
botScnH := 8
statScnW := 26
tui.h = h
tui.w = w
tui.resX = 0
tui.resY = 2
tui.resW = w - statScnW
tui.latX = 0
tui.latY = h - botScnH
tui.latW = w
tui.topVSplitX = tui.resW
tui.topVSplitY = 1
tui.topVSplitH = h - botScnH
tui.statX = tui.topVSplitX + 1
tui.statY = 2
tui.statW = statScnW
tui.msgX = 0
tui.msgY = h - botScnH + 1
tui.msgW = (w+1)/2 + 1
tui.botVSplitX = tui.msgW
tui.botVSplitY = h - botScnH
tui.botVSplitH = botScnH
tui.errX = tui.botVSplitX + 1
tui.errY = h - botScnH + 1
tui.errW = w - tui.msgW - 1
tui.res = table{6, []int{13, 5, 7, 7, 7, 8}, 0, 2, 0, justifyRight, noBorder}
tui.results = make([][]string, 0)
tui.msg = table{1, []int{tui.msgW}, tui.msgX, tui.msgY, 0, justifyLeft, noBorder}
tui.msgRing = make([]string, botScnH-1)
tui.err = table{1, []int{tui.errW}, tui.errX, tui.errY, 0, justifyLeft, noBorder}
tui.errRing = make([]string, botScnH-1)
ui = tui
go func() {
for {
switch ev := tm.PollEvent(); ev.Type {
case tm.EventKey:
if ev.Key == tm.KeyEsc || ev.Key == tm.KeyCtrlC {
finiServer()
os.Exit(0)
}
case tm.EventResize:
}
}
}()
return nil
}