package term

import (
	
	
)

// termFile is the file descriptor used for all low-level terminal queries (size,
// cursor position) and escape sequences. We deliberately use stderr rather than
// stdout: stdout is the stream most likely to be redirected (e.g. `app | other`),
// whereas stderr usually stays attached to the controlling terminal, giving a
// reliable terminal size even when the program's output is piped.
var termFile = os.Stderr

// fallback terminal width when we can't get it through query.
var defaultTermWidth = 80

// GetWidth returns the width of the terminal or 80 if it cannot be established.
func () ( int) {
	var  error
	 := int(termFile.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(termFile.Fd())

	, ,  := GetSize()
	if  != nil ||  == 0 {
		return defaultTermWidth
	}

	return 
}

func printf( string,  ...interface{}) {
	WriteString(fmt.Sprintf(, ...))
}

// EnableBracketedPaste enables bracketed paste mode.
func () {
	WriteString(BracketedPasteStart)
}

// DisableBracketedPaste disables bracketed paste mode.
func () {
	WriteString(BracketedPasteEnd)
}