Description
I would like to propose the addition of a set of functions and supporting data types to support getting / setting terminal window size across platforms.
This would also likely require the addition of something like this to x/sys:
func GetWindowSize(fd int) (winsize *Winsize, err error) {}
func SetWindowSize(fd int, ws *Winsize) (err error) {}
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
On Linux, OS X, etc. this is done via syscalls using ioctl(), etc. On Windows, this is done possibly via GetConsoleScreenBufferInfo and SetConsoleWindowInfo. On Solaris, this is done via libc.ioctl().
Docker (pkg/term/*) and other Go-based projects like to retrieve or set this information, it would be helpful if this was abstracted away for various projects as can be seen in a simple github search of Go source files:
I am willing to provide the implementation and tests for Solaris, and Linux, and I can attempt one for Windows.
I have not proposed an addition before to any of the Go packages or tools, so please forgive me if I have not adhered to the correct process ( I'm attempting to follow https://github.com/golang/proposal#readme ).
I don't know if the sys package is the most appropriate place for this or not; I'm just trying to figure out how to avoid the current situation of duplicating terminal information code across various Go projects in the community leading to them not working as expected or being unsupported on some platforms.