Change type name to be more NEP-1-ish as per Araq request.
This commit is contained in:
parent
5db1de87b1
commit
8df2078f08
2 changed files with 3 additions and 3 deletions
|
|
@ -263,9 +263,9 @@ proc tcGetSid*(fd: cint): Pid {.importc: "tcgetsid", header: "<termios.h>".}
|
||||||
# Window size ioctl. Should work on on any Unix that xterm has been ported to.
|
# Window size ioctl. Should work on on any Unix that xterm has been ported to.
|
||||||
var TIOCGWINSZ*{.importc, header: "<sys/ioctl.h>".}: culong
|
var TIOCGWINSZ*{.importc, header: "<sys/ioctl.h>".}: culong
|
||||||
|
|
||||||
type ioctl_winsize* {.importc: "struct winsize", header: "<termios.h>",
|
type IOctl_WinSize* {.importc: "struct winsize", header: "<termios.h>",
|
||||||
final, pure.} = object
|
final, pure.} = object
|
||||||
ws_row*, ws_col*, ws_xpixel*, ws_ypixel*: cushort
|
ws_row*, ws_col*, ws_xpixel*, ws_ypixel*: cushort
|
||||||
|
|
||||||
proc ioctl*(fd: cint, request: culong, reply: ptr ioctl_winsize): int {.
|
proc ioctl*(fd: cint, request: culong, reply: ptr IOctl_WinSize): int {.
|
||||||
importc: "ioctl", header: "<stdio.h>", varargs.}
|
importc: "ioctl", header: "<stdio.h>", varargs.}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ else:
|
||||||
proc terminalWidthIoctl*(fds: openArray[int]): int =
|
proc terminalWidthIoctl*(fds: openArray[int]): int =
|
||||||
## Returns terminal width from first fd that supports the ioctl.
|
## Returns terminal width from first fd that supports the ioctl.
|
||||||
|
|
||||||
var win: ioctl_winsize
|
var win: IOctl_WinSize
|
||||||
for fd in fds:
|
for fd in fds:
|
||||||
if ioctl(cint(fd), TIOCGWINSZ, addr win) != -1:
|
if ioctl(cint(fd), TIOCGWINSZ, addr win) != -1:
|
||||||
return int(win.ws_col)
|
return int(win.ws_col)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue