LED is a lightweight text editor written using Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
306 B

package utils
import (
"github.com/pkg/term"
)
// Getch simply listens for input from stdin
func Getch() []byte {
t, _ := term.Open("/dev/tty")
term.RawMode(t)
bytes := make([]byte, 3)
numRead, err := t.Read(bytes)
t.Restore()
t.Close()
if err != nil {
return nil
}
return bytes[0:numRead]
}