Some improvements for terminal mode
This commit is contained in:
parent
bd0d1aaebe
commit
50da13d169
12
main.go
12
main.go
|
@ -32,9 +32,21 @@ func main() {
|
||||||
if res.column > 1 {
|
if res.column > 1 {
|
||||||
unix.Write(1, []byte("🚫\n")) // U+1F6AB
|
unix.Write(1, []byte("🚫\n")) // U+1F6AB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
term, _ := unix.IoctlGetTermios(1, unix.TCGETS)
|
||||||
|
if term != nil {
|
||||||
|
term.Lflag = term.Lflag &^ unix.ECHO
|
||||||
|
unix.IoctlSetTermios(1, unix.TCSETS, term)
|
||||||
|
}
|
||||||
|
|
||||||
for _, b := range res.extraBytes {
|
for _, b := range res.extraBytes {
|
||||||
unix.Syscall(unix.SYS_IOCTL, 0, unix.TIOCSTI, uintptr(unsafe.Pointer(&b)))
|
unix.Syscall(unix.SYS_IOCTL, 0, unix.TIOCSTI, uintptr(unsafe.Pointer(&b)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if term != nil {
|
||||||
|
term.Lflag = term.Lflag | unix.ECHO
|
||||||
|
unix.IoctlSetTermios(1, unix.TCSETS, term)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func awaitDSR() <-chan dsrResult {
|
func awaitDSR() <-chan dsrResult {
|
||||||
|
|
Loading…
Reference in New Issue