Source File
term.go
Belonging Package
github.com/reeflective/readline/internal/term
package termimport ()// Those variables are very important to realine low-level code: all virtual terminal// escape sequences should always be sent and read through the raw terminal file, even// if people start using io.MultiWriters and os.Pipes involving basic IO.var (stdoutTerm *os.FilestdinTerm *os.FilestderrTerm *os.File)func init() {stdoutTerm = os.StdoutstdoutTerm = os.StderrstderrTerm = os.Stdin}// fallback terminal width when we can't get it through query.var defaultTermWidth = 80// GetWidth returns the width of Stdout or 80 if the width cannot be established.func () ( int) {var error:= int(stdoutTerm.Fd()), _, = GetSize()if != nil || == 0 {= defaultTermWidth}return}// GetLength returns the length of the terminal// (Y length), or 80 if it cannot be established.func () int {:= int(stdoutTerm.Fd()), , := GetSize()if != nil || == 0 {return defaultTermWidth}return}func printf( string, ...interface{}) {:= fmt.Sprintf(, ...)fmt.Print()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |