Documentation ¶
Index ¶
- Variables
- func Backspace(out io.Writer) error
- func CursorBackward(out io.Writer) error
- func CursorDown(out io.Writer) error
- func CursorForward(out io.Writer) error
- func CursorUp(out io.Writer) error
- func DeleteChar(out io.Writer) error
- func DisplayWidth(data string) (width, height int, err error)
- func EraseLine(out io.Writer) error
- func EraseLineHead(out io.Writer) error
- func EraseLineTail(out io.Writer) error
- func EraseScreen(out io.Writer) error
- func EraseScreenHead(out io.Writer) error
- func EraseScreenTail(out io.Writer) error
- func HBlock(width int, fract float64, empty rune) string
- func MoveTo(out io.Writer, row, col int) error
- func ParseHexDump(data []byte) ([]byte, error)
- func ScrollDown(out io.Writer) error
- func ScrollUp(out io.Writer) error
- func Sparkline(values []int) string
- func SparklineRange(min, max int, values []int) string
- func Trim(data string) (lines []string, err error)
- type Char
- type CharDisplay
- type Display
- func (d *Display) Clear(from, to Point)
- func (d *Display) DECALN(size Point)
- func (d *Display) DeleteChars(size, p Point, count int)
- func (d *Display) InsertChars(size, p Point, count int)
- func (d *Display) Resize(width, height int)
- func (d *Display) ScrollUp(top, bottom, count int)
- func (d *Display) Set(p Point, char Char)
- func (d *Display) Size() Point
- type Emulator
- type Point
- type Stringer
- func (d *Stringer) Clear(from, to Point)
- func (d *Stringer) DECALN(size Point)
- func (d *Stringer) DeleteChars(size, p Point, count int)
- func (d *Stringer) InsertChars(size, p Point, count int)
- func (d *Stringer) ScrollUp(top, bottom, count int)
- func (d *Stringer) Set(p Point, char Char)
- func (d *Stringer) Size() Point
Constants ¶
This section is empty.
Variables ¶
var ( Black = color.NRGBA{0x00, 0x00, 0x00, 0xff} Red = color.NRGBA{0xcd, 0x00, 0x00, 0xff} Green = color.NRGBA{0x00, 0xcd, 0x00, 0xff} Yellow = color.NRGBA{0xcd, 0xcd, 0x00, 0xff} Blue = color.NRGBA{0x00, 0x00, 0xee, 0xff} Magenta = color.NRGBA{0xcd, 0x00, 0xcd, 0xff} Cyan = color.NRGBA{0x00, 0xcd, 0xcd, 0xff} White = color.NRGBA{0xe5, 0xe5, 0xe5, 0xff} BrightWhite = color.NRGBA{0xff, 0xff, 0xff, 0xff} )
Emulator color codes.
Functions ¶
func Backspace ¶
Backspace moves cursor one column left. Backspace does nothing if the cursor is already at the leftmost column.
func CursorBackward ¶
CursorBackward moves the cursor one column left. Stops at the left edge of screen.
func CursorForward ¶
CursorForward moves the cursor one column right. Stops at the right edge of screen.
func DeleteChar ¶
DeleteChar deletes character from the current cursor position.
func DisplayWidth ¶
DisplayWidth computes the character size width of the argument data when all emulator control codes have been removed.
func EraseLineHead ¶
EraseLineHead clears the current line from the beginning of the line to cursor position (inclusively).
func EraseLineTail ¶
EraseLineTail clears the current line from the cursor position to the end of line (inclusively).
func EraseScreenHead ¶
EraseScreenHead clears the screen from the beginning of the screen to cursor position (inclusively).
func EraseScreenTail ¶
EraseScreenTail clears the screen from cursor position to the end of screen (inclusively).
func HBlock ¶
HBlock creates a horizontal block that is width characters long. The fract argument specifies the fraction ([0...1]) of the width that is rendered with the Unicode block drawing characters, starting from the left edge. The remaining empty fraction of the block is padded with the empty rune.
func ParseHexDump ¶
ParseHexDump parses data from the encoding/hex.Dump formatted output.
func Sparkline ¶
Sparkline creates a histogram chart of values. The chart is scaled to [min...max] values in the values array.
func SparklineRange ¶
SparklineRange creates a histogram chart of values. The chart is scaled to [min...max]. Values smaller than min are rendered with space (u0020) and values larger than max are rendered with 'Light Shade' (u2591).
Types ¶
type Char ¶
type Char struct { Code rune Foreground color.NRGBA Background color.NRGBA Bold bool Italic bool Underline bool }
Char defines the column character and properties in emulator display.
type CharDisplay ¶
type CharDisplay interface { // Size returns the display size. Size() Point // Clear clears the display region (inclusively). Clear(from, to Point) // DECALN fills the screen with 'E'. DECALN(size Point) // Set sets the character at the specified point. Set(p Point, char Char) // InsertChars insert count number of characters to the specified // point. InsertChars(size, p Point, count int) // DeleteChars delets count number of characters from the // specified point. DeleteChars(size, p Point, count int) // ScrollUp scrolls the screen up count lines. ScrollUp(top, bottom, count int) }
CharDisplay implements terminal display.
type Display ¶
Display implements fixed size CharDisplay.
func NewDisplay ¶
NewDisplay creates a display with the given dimensions.
func (*Display) DeleteChars ¶
DeleteChars implements the CharDisplay.DeleteChars function.
func (*Display) InsertChars ¶
InsertChars implements the CharDisplay.InsertChars function.
type Emulator ¶
type Emulator struct { Size Point Cursor Point Default Char // contains filtered or unexported fields }
Emulator implements terminal emulator.
func NewEmulator ¶
func NewEmulator(stdout, stderr io.Writer, display CharDisplay) *Emulator
NewEmulator creates a new terminal emulator.
type Point ¶
Point defines a 2D point.
type Stringer ¶
type Stringer struct {
// contains filtered or unexported fields
}
Stringer implements the CharDisplay interface to create plain-text string versions of the input.
func (*Stringer) DeleteChars ¶
DeleteChars implements the CharDisplay.DeleteChars function.
func (*Stringer) InsertChars ¶
InsertChars implements the CharDisplay.InsertChars function.