Documentation ¶
Index ¶
- type Buffer
- func (buf *Buffer) Cap() int
- func (buf *Buffer) Configure(mode eol.Mode) *Buffer
- func (buf *Buffer) Last() []byte
- func (buf *Buffer) Len() int
- func (buf *Buffer) Parse(isPasting bool) (r rune, n int)
- func (buf *Buffer) Read(p []byte) (n int, err error)
- func (buf *Buffer) ReadByte() (b byte, err error)
- func (buf *Buffer) ReadFrom(r io.Reader) (n int64, err error)
- func (buf *Buffer) Reset()
- func (buf *Buffer) Write(p []byte) (n int, err error)
- func (buf *Buffer) WriteByte(b byte) (err error)
- func (buf *Buffer) WriteEOL() (n int, err error)
- func (buf *Buffer) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct { Byte [limits.BytesPerBuffer]byte // contains filtered or unexported fields }
Buffer defines an I/O buffer for Terminal control/data byte sequences.
func (*Buffer) Parse ¶
Parse tries to parse a key sequence from buf. If successful, it returns the key r and its size n in bytes. Otherwise, it returns key.Error and n=0.
Parse does its best to recognize sequences defined by VT10x and xterm line disciplines.
Parse consumes the bytes that contribute to the returned key r. If an entire sequence could not be parsed, no bytes are consumed.
func (*Buffer) Read ¶
Read copies up to len(p) unread bytes from buf to p and returns the number of bytes copied.
func (*Buffer) ReadByte ¶
ReadByte returns the next unread byte from buf and a nil error. If buf is empty, returns 0, io.EOF.
To avoid ambiguous validity of the returned byte, ReadByte will always return either a valid byte and nil error, or an invalid byte and non-nil error. In particular, ReadByte never returns a byte read along with error == io.EOF.
func (*Buffer) ReadFrom ¶
ReadFrom copies bytes from r to buf until all bytes have been read or an error was encountered. Returns the number of bytes successfully copied.
A successful ReadFrom returns err == nil and not err == io.EOF. ReadFrom is defined to read from r until all bytes have been read (io.EOF), so it does not treat io.EOF from r as an error to be reported.
Bytes are copied directly without any buffering, so r and buf must not overlap if both are implemented as buffers of physical memory.
func (*Buffer) Write ¶
Write appends up to len(p) bytes from p to buf and returns the number of bytes copied.
Write will only write to the free space in buf and then return ErrWriteOverflow if all of p could not be copied.
func (*Buffer) WriteByte ¶
WriteByte appends b to buf and returns nil. If buf is full, returns ErrWriteOverflow.
func (*Buffer) WriteTo ¶
WriteTo copies bytes from buf to w until all bytes have been written or an error was encountered. Returns the number of bytes successfully copied.
Bytes are copied directly without any buffering, so w and buf must not overlap if both are implemented as buffers of physical memory.