Merge pull request #56 from byung2/fix-resize

Fix bugs when resizing a terminal
This commit is contained in:
Manfred Touron 2018-04-11 16:33:20 +02:00 committed by GitHub
commit f4e7938ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -20,11 +20,12 @@ func resetSignalSIGWINCH() {
} }
func syscallTIOCGWINSZ() ([]byte, error) { func syscallTIOCGWINSZ() ([]byte, error) {
ws, err := unix.IoctlGetWinsize(0, 0) ws, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ)
if err != nil { if err != nil {
return nil, fmt.Errorf("ioctl error: %v", err) return nil, fmt.Errorf("ioctl error: %v", err)
} }
b, err := json.Marshal(ws) tws := winsize{Rows: ws.Row, Columns: ws.Col}
b, err := json.Marshal(tws)
if err != nil { if err != nil {
return nil, fmt.Errorf("json.Marshal error: %v", err) return nil, fmt.Errorf("json.Marshal error: %v", err)
} }