Documentation
¶
Index ¶
- Variables
- func RuneWidth(ch rune) int
- func StringWidth(s string) int
- type ByteAndError
- type MockTerm
- func (m *MockTerm) CanWrite() bool
- func (m *MockTerm) CanWriteChars(charWidth int) bool
- func (m *MockTerm) Clear()
- func (m *MockTerm) Finish()
- func (m *MockTerm) Flush() error
- func (m *MockTerm) Height() int
- func (m *MockTerm) MoveTo(newX, newY int)
- func (m *MockTerm) NewLine() bool
- func (m *MockTerm) ReadByteTimeout(timeout time.Duration) (byte, error)
- func (m *MockTerm) Tab()
- func (m *MockTerm) Width() int
- func (m *MockTerm) WriteRune(ch rune) bool
- func (m *MockTerm) WriteString(s string) bool
- func (m *MockTerm) WriteZeroWidthBytes(bytes []byte)
- func (m *MockTerm) WriteZeroWidthString(s string)
- type Term
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrReadTimedOut = errors.New("read timed out") ErrReadClosing = errors.New("termio closing") )
Functions ¶
func StringWidth ¶
RuneWidth returns the width in the number of characters of a given string.
Types ¶
type ByteAndError ¶
type ByteAndError struct {
// contains filtered or unexported fields
}
type MockTerm ¶
func (*MockTerm) CanWriteChars ¶
func (*MockTerm) ReadByteTimeout ¶
func (*MockTerm) WriteString ¶
func (*MockTerm) WriteZeroWidthBytes ¶
func (*MockTerm) WriteZeroWidthString ¶
type Term ¶
type Term interface { // Width returns the terminal width. Width() int // Height returns the terminal height. Height() int // Clear clears the internal buffer, but it won't flush. Clear also refreshes the terminal size. Clear() // Flush flushes the internal buffer to the output terminal. Flush() error // Finish cleans up the terminal and restores the original state. Finish() // WriteZeroWidthString writes a string to the internal buffer without moving the cursor. WriteZeroWidthString(s string) // WriteZeroWidthBytes writes a byte array to the internal buffer without moving the cursor. WriteZeroWidthBytes(bytes []byte) // MoveTo moves the cursor to a given position. MoveTo(newX, newY int) // Tab moves the cursor to the next tab position. Tab() // Can write returns whether to be able to write anything at the cursor position without overflowing the terminal. CanWrite() bool // Can write returns whether to be able to write a char of a given width at the cursor position without overflowing the terminal. CanWriteChars(charWidth int) bool // NewLine moves the cursor to the beginning of the next line. NewLine() bool // WriteString writes a string to the internal buffer and moves the cursor. WriteString(s string) bool // WriteString writes a rune to the internal buffer and moves the cursor. WriteRune(ch rune) bool // ReadByteTimeout reads a byte from terminal with a timeout. ReadByteTimeout(timeout time.Duration) (byte, error) }
Click to show internal directories.
Click to hide internal directories.