From 4e24b235c30a47b05920871596131beca3d4dcd0 Mon Sep 17 00:00:00 2001 From: Jeff Lindsay Date: Wed, 20 Feb 2013 12:19:22 +0000 Subject: [PATCH] make sure the standard "replace input carriage returns with line feeds" and "replace output line feeds with carriage return and line feed" flags are set, even on raw (I dont think it should actually be raw) --- term.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/term.go b/term.go index 8b58611cd9..7606cbd42b 100644 --- a/term.go +++ b/term.go @@ -123,9 +123,11 @@ func MakeRaw(fd int) (*State, error) { if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(getTermios), uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { return nil, err } - + newState := oldState.termios - newState.Iflag &^= istrip | INLCR | ICRNL | IGNCR | IXON | IXOFF + newState.Iflag &^= ISTRIP | INLCR | IGNCR | IXON | IXOFF + newState.Iflag |= ICRNL + newState.Oflag |= ONLCR newState.Lflag &^= ECHO | ICANON | ISIG if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { return nil, err