提交 22b661d1 编写于 作者: D Derek Parker

fix readline support: window resizing

上级 505ae448
......@@ -10,7 +10,32 @@ package goreadline
#cgo LDFLAGS: -lreadline
*/
import "C"
import "unsafe"
import (
"os"
"os/signal"
"syscall"
"unsafe"
)
func init() {
C.rl_catch_sigwinch = 0
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGWINCH)
go func() {
for sig := range c {
switch sig {
case syscall.SIGWINCH:
Resize()
default:
}
}
}()
}
func Resize() {
C.rl_resize_terminal()
}
func ReadLine(prompt *string) *string {
var cPrompt *C.char
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册