pkg / term

Package term manages POSIX terminals.
BSD 2-Clause "Simplified" License
392 stars 66 forks source link

add GetSpeed() #45

Closed gdamore closed 4 years ago

gdamore commented 5 years ago

This adds a new API, GetSpeed(), which allows us to retrieve the output baud rate (we assume output and input are the same I've never seen that not be the case). The main use for this is for applications like Tcell (GitHub.com/gdamore/tcell) -- we need the baud rate to calculate how many padding characters we should insert when allowing for padding-based delays as specified by terminfo.

The methods here are derived in part from my own tcell package, but adjusted for use here. This is one more area where the operating systems differ significantly.

This is one of a series of improvements I hope to contribute which will allow me to use this package from within tcell. (Further improvements will be code to get the window size via TIOCGWINSIZE, and some portability fixes, including changes to reduce the dependency upon cgo for some platforms.)

gdamore commented 4 years ago

I guess the conflict resolution would be to remove term_windows.go. But I also guess, since I posted this nearly a year ago, that there is little or zero interest in accepting this PR. I'm no longer making use of this package myself. Feel free to just decline the PR if you like.

davecheney commented 4 years ago

Sorry for the long delay in merging this. I don't know what I was thinking with term_windows.go, it never worked.