// TerminalSize retrieves the cols/rows for the terminal connected to out.

TerminalSize retrieves the cols/rows for the terminal connected to out.
// TerminalSize retrieves the cols / rows for the terminal connected to out .
func TerminalSize(out *os.File) (int, int, error) {
	csbi := new(consoleScreenBufferInfo)
	ret, _, err := getConsoleScreenBufferInfo.Call(out.Fd(),
		uintptr(unsafe.Pointer(csbi)))
	if ret == 0 {
		return 0, 0, err
	}
	cols := csbi.window.right - csbi.window.left + 1
	rows := csbi.window.bottom - csbi.window.top + 1
	return int(cols), int(rows), nil
}
func TerminalSize ( out * os . File ) ( int , int , error ) { csbi := new ( consoleScreenBufferInfo ) ret , _ , err := getConsoleScreenBufferInfo . Call ( out . Fd ( ) , uintptr ( unsafe . Pointer ( csbi ) ) ) if ret == 0 { return 0 , 0 , err } cols := csbi . window . right - csbi . window . left + 1 rows := csbi . window . bottom - csbi . window . top + 1 return int ( cols ) , int ( rows ) , nil }
TerminalSize retrieves the cols/rows for the terminal connected to out.
TerminalSize retrieves the cols / rows for the terminal connected to out .
// Results are always off by one.
