示例#1
0
func (t *tScreen) getWinSize() (int, int, error) {
	var cx, cy C.int
	if r, e := C.getwinsize(C.int(t.out.Fd()), &cx, &cy); r != 0 {
		return 0, 0, e
	}
	return int(cx), int(cy), nil
}
示例#2
0
// GetWinsize queries the size of the terminal referenced by the given file
// descriptor.
func GetWinsize(fd int) (row, col int) {
	var r, c C.int
	C.getwinsize(C.int(fd), &r, &c)
	return int(r), int(c)
}