mirror of https://github.com/chzyer/readline.git
fix build in windows
This commit is contained in:
parent
7537bea372
commit
c814ccae9a
5
utils.go
5
utils.go
|
@ -1,11 +1,16 @@
|
||||||
package readline
|
package readline
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"syscall"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
StdinFd = int(uintptr(syscall.Stdin))
|
||||||
|
)
|
||||||
|
|
||||||
// IsTerminal returns true if the given file descriptor is a terminal.
|
// IsTerminal returns true if the given file descriptor is a terminal.
|
||||||
func IsTerminal(fd int) bool {
|
func IsTerminal(fd int) bool {
|
||||||
return terminal.IsTerminal(fd)
|
return terminal.IsTerminal(fd)
|
||||||
|
|
|
@ -7,10 +7,6 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
StdinFd = syscall.Stdin
|
|
||||||
)
|
|
||||||
|
|
||||||
type winsize struct {
|
type winsize struct {
|
||||||
Row uint16
|
Row uint16
|
||||||
Col uint16
|
Col uint16
|
||||||
|
|
|
@ -33,7 +33,6 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
StdinFd = 0
|
|
||||||
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||||
tmp_info console_screen_buffer_info
|
tmp_info console_screen_buffer_info
|
||||||
|
|
||||||
|
@ -63,5 +62,5 @@ func get_term_size(out syscall.Handle) coord {
|
||||||
|
|
||||||
// get width of the terminal
|
// get width of the terminal
|
||||||
func getWidth() int {
|
func getWidth() int {
|
||||||
return int(get_term_size(syscall.Stdin).x)
|
return int(get_term_size(syscall.Stdout).x)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue