Documentation
¶
Index ¶
Constants ¶
const ( // Normal (default) attribtues -- VT100. NORMAL = 0 // Bold -- VT100. BOLD = 1 // Faint, decreased intensity -- ECMA-48 2e. FAINT = 2 // Italicizsed -- ECMA-48 2e. ITALICS = 3 // Underlined -- VT100. UNDERLINE = 4 // Blinking -- VT100. BLINK = 5 // Inverse video -- VT100. INVERSE = 7 // Crossed-out characters -- ECMA-48 3e. STRIKETHROUGH = 9 // Black colour -- ANSI. BLACK = 0 // Red colour -- ANSI. RED = 1 // Green colour -- ANSI. GREEN = 2 // Yellow colour -- ANSI. YELLOW = 3 // Blue colour -- ANSI. BLUE = 4 // Magenta colour -- ANSI. MAGENTA = 5 // Cyan colour -- ANSI. CYAN = 6 // White colour -- ANSI. WHITE = 7 // Default colour -- ANSI. DEFAULT = 9 // Offset for foreground colours. FGOFFSET = 30 // Offset for background colours. BGOFFSET = 40 )
CSI Pm [; Pm ...] m -- Character Attributes (SGR).
const ( // Amount of time to delay semaphore acquisition loops. MailboxDelaySleep time.Duration = 50 * time.Millisecond // Default deadline for context timeouts. DefaultCtxDeadline time.Duration = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorString ¶ added in v0.1.1
type ColorString struct {
// contains filtered or unexported fields
}
Colour string.
Generates a string that, with the right terminal type, display text using various character attributes.
To find out more, consult your nearest DEC VT340 programmer's manual or the latest ECMA-48 standard.
func MakeColorString ¶ added in v0.1.1
func MakeColorString() *ColorString
Make a new coloured string.
func MakeColorStringWithAttrs ¶ added in v0.3.3
func MakeColorStringWithAttrs(data string, attr, foreg, backg int) *ColorString
Make a new coloured string with the given attributes.
func (*ColorString) SetAttr ¶ added in v0.1.1
func (cs *ColorString) SetAttr(attr int)
Set the character attribute.
func (*ColorString) SetBG ¶ added in v0.1.1
func (cs *ColorString) SetBG(col int)
Set the background colour.
func (*ColorString) SetFG ¶ added in v0.1.1
func (cs *ColorString) SetFG(col int)
Set the foreground colour.
func (*ColorString) SetString ¶ added in v0.1.1
func (cs *ColorString) SetString(val string)
Set the string to display.
func (*ColorString) String ¶ added in v0.1.1
func (cs *ColorString) String() string
Convert to a string.
Warning: the resulting string will contain escape sequences for use with a compliant terminal or terminal emulator.
type Mailbox ¶
type Mailbox struct {
// contains filtered or unexported fields
}
Mailbox structure.
This is a cheap implementation of a mailbox.
It uses two semaphores to control read and write access, and contains a single datum.
This is *not* a queue!
func NewMailbox ¶
func NewMailbox() *Mailbox
Create and return a new empty mailbox.
Note: this acquires the `preventRead` semaphore.
func (*Mailbox) Get ¶
Get an element from the mailbox. Defaults to using a context with a deadline of 5 seconds.
func (*Mailbox) GetWithContext ¶
Get an element from the mailbox using the provided context.
It is recommended to use a context that has a timeout deadline.