File tree Expand file tree Collapse file tree 3 files changed +14
-23
lines changed Expand file tree Collapse file tree 3 files changed +14
-23
lines changed Original file line number Diff line number Diff line change @@ -2,4 +2,7 @@ module github.com/zyedidia/terminal
22
33go 1.19
44
5- require github.com/creack/pty v1.1.18
5+ require (
6+ github.com/creack/pty v1.1.18
7+ golang.org/x/sys v0.28.0
8+ )
Original file line number Diff line number Diff line change 11github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY =
22github.com/creack/pty v1.1.18 /go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4 =
3+ golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA =
4+ golang.org/x/sys v0.28.0 /go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA =
Original file line number Diff line number Diff line change 33package terminal
44
55import (
6- "os"
7- "syscall"
8- "unsafe"
6+ "golang.org/x/sys/unix"
97)
108
11- func ioctl (f * os.File , cmd , p uintptr ) error {
12- _ , _ , errno := syscall .Syscall (
13- syscall .SYS_IOCTL ,
14- f .Fd (),
15- syscall .TIOCSWINSZ ,
16- p )
17- if errno != 0 {
18- return syscall .Errno (errno )
19- }
20- return nil
21- }
22-
239func (t * VT ) ptyResize () error {
2410 if t .pty == nil {
2511 return nil
2612 }
27- var w struct { row , col , xpix , ypix uint16 }
28- w . row = uint16 (t .dest .rows )
29- w . col = uint16 (t .dest .cols )
30- w . xpix = 16 * uint16 (t .dest .cols )
31- w . ypix = 16 * uint16 (t .dest .rows )
32- return ioctl ( t . pty , syscall . TIOCSWINSZ ,
33- uintptr ( unsafe . Pointer ( & w )) )
13+ w := & unix. Winsize {
14+ Row : uint16 (t .dest .rows ),
15+ Col : uint16 (t .dest .cols ),
16+ Xpixel : 16 * uint16 (t .dest .cols ),
17+ Ypixel : 16 * uint16 (t .dest .rows ),
18+ }
19+ return unix . IoctlSetWinsize ( int ( t . pty . Fd ()), unix . TIOCSWINSZ , w )
3420}
You can’t perform that action at this time.
0 commit comments