mattn / go-tty

MIT License
211 stars 18 forks source link

tinygo does not implement WriteString() for *os.File #39

Closed srlehn closed 4 years ago

srlehn commented 4 years ago

Replace WriteString() calls on *os.File with Write() so that tinygo compiles.

srlehn commented 4 years ago

(f *os.File) WriteString(s string) is only a call to Write() with the string cast to a []byte.

func (f *File) WriteString(s string) (n int, err error) {
    return f.Write([]byte(s))
}

This PR should not change any behaviour. I did replace strings containing a single ASCII char with rune '*', '\n'. The variable rune r in case displayRune must be cast to a string first.

srlehn commented 4 years ago

The error I got before changing the writes:

grafik

mattn commented 4 years ago

Thank you. Could you please make new global variable?

var linefeed = []byte{'\n'}
srlehn commented 4 years ago

done

mattn commented 4 years ago

Thank you