terminal

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Console

func Console(th *Theme, screen *Screen, settings *ConsoleSettings) layout.Widget

Types

type AnsiReader

type AnsiReader struct {
	Input []byte

	Screen *Screen
	// contains filtered or unexported fields
}

func (*AnsiReader) HasNext

func (r *AnsiReader) HasNext() bool

func (*AnsiReader) Next

func (r *AnsiReader) Next() byte

func (*AnsiReader) Parse

func (r *AnsiReader) Parse()

func (*AnsiReader) PeekN

func (r *AnsiReader) PeekN(i int) []byte

func (*AnsiReader) UpUntil

func (r *AnsiReader) UpUntil(f func(b byte) bool) string

type AnsiToken

type AnsiToken interface {
}

type CharacterToken

type CharacterToken struct {
	AnsiToken
	Character byte
}

type ConsoleSettings added in v0.0.11

type ConsoleSettings struct {
	// contains filtered or unexported fields
}

func NewConsoleSettings added in v0.0.9

func NewConsoleSettings(opts ...Option) *ConsoleSettings

func (*ConsoleSettings) Events added in v0.0.11

func (s *ConsoleSettings) Events() []LayoutChangedEvent

type Defaults

type Defaults struct {
	FgColor  color.NRGBA
	BgColor  color.NRGBA
	Font     font.Font
	BoldFont font.Font
	FontSize unit.Sp
}

type EmptyToken

type EmptyToken struct {
	AnsiToken
}

type EscapeSequence

type EscapeSequence struct {
	Tokens []AnsiToken
}

func (EscapeSequence) ApplyOn

func (t EscapeSequence) ApplyOn(s *Screen) error

func (EscapeSequence) ExpectNumber

func (t EscapeSequence) ExpectNumber(n int, default_ int) (int, error)

type LayoutChangedEvent added in v0.0.9

type LayoutChangedEvent struct {
	Type LayoutUpdateType
}

type LayoutUpdateType added in v0.0.9

type LayoutUpdateType int
const (
	LayoutUpdateNone   LayoutUpdateType = iota
	LayoutUpdateWidth  LayoutUpdateType = 1 << 0
	LayoutUpdateHeight LayoutUpdateType = 1 << 1
)

type Line

type Line struct {
	// contains filtered or unexported fields
}

This is a line as displayed in the terminal emulator, it will never be longer than its current width

func (*Line) AddRun added in v0.0.9

func (l *Line) AddRun(tail Run)

func (*Line) Length added in v0.0.9

func (l *Line) Length() int

func (*Line) String

func (l *Line) String() string

func (*Line) Write

func (l *Line) Write(text string, x int, style Style)

type NumberToken

type NumberToken struct {
	AnsiToken
	Number int
}

type Option added in v0.0.9

type Option func(settings *ConsoleSettings)

func MaxSize added in v0.0.9

func MaxSize(columns, rows int) Option

type Point

type Point struct {
	X, Y int
}

type Run

type Run struct {
	// contains filtered or unexported fields
}

Runs should always be consecutive

func (Run) CopyFrom

func (r Run) CopyFrom(i int) Run

func (Run) CopyTo

func (r Run) CopyTo(x int) Run

func (Run) IsEmpty

func (r Run) IsEmpty() bool

func (Run) Split added in v0.0.9

func (r Run) Split(maxLength int) (Run, Run, bool)

type Screen

type Screen struct {
	Size Point
	// contains filtered or unexported fields
}

func NewScreen

func NewScreen(size Point, updatedChannel chan interface{}) *Screen

func (*Screen) Buffer

func (s *Screen) Buffer() string

func (*Screen) CursorRight

func (s *Screen) CursorRight(i int)

func (*Screen) CursorUp

func (s *Screen) CursorUp(i int)

func (*Screen) Lines

func (s *Screen) Lines() []Line

func (*Screen) Reset added in v0.0.12

func (s *Screen) Reset()

func (*Screen) SetBold

func (s *Screen) SetBold(b bool)

func (*Screen) SetFaint added in v0.0.12

func (s *Screen) SetFaint(b bool)

func (*Screen) SetForegroundColor

func (s *Screen) SetForegroundColor(c color.NRGBA)

func (*Screen) SetForegroundColorAnsi256 added in v0.0.12

func (s *Screen) SetForegroundColorAnsi256(c int)

func (*Screen) SetForegroundColorAnsi8 added in v0.0.12

func (s *Screen) SetForegroundColorAnsi8(c int, b bool)

The following are primitives that are used by the parser

func (*Screen) VirtualLines added in v0.0.9

func (s *Screen) VirtualLines() []VirtualLine

func (*Screen) VisibleLines

func (s *Screen) VisibleLines() []Line

func (*Screen) Write

func (s *Screen) Write(p []byte) (n int, err error)

func (*Screen) WriteCarriageReturn

func (s *Screen) WriteCarriageReturn()

func (*Screen) WriteCharacters

func (s *Screen) WriteCharacters(text string)

func (*Screen) WriteNewLine

func (s *Screen) WriteNewLine()

func (*Screen) WriteString

func (s *Screen) WriteString(s2 string) error

type Style

type Style struct {
	BgColor color.NRGBA
	Bold    bool
	Faint   bool
	// contains filtered or unexported fields
}

func (*Style) FgColor

func (s *Style) FgColor() color.NRGBA

func (*Style) Reset added in v0.0.12

func (s *Style) Reset(fgColor color.NRGBA, bgColor color.NRGBA)

func (*Style) SetBackgroundColor

func (s *Style) SetBackgroundColor(bgColor color.NRGBA)

func (*Style) SetFaint added in v0.0.12

func (s *Style) SetFaint(b bool)

func (*Style) SetForegroundAnsi256 added in v0.0.12

func (s *Style) SetForegroundAnsi256(c int)

func (*Style) SetForegroundAnsi8 added in v0.0.12

func (s *Style) SetForegroundAnsi8(i int, bright bool)

func (*Style) SetForegroundColor

func (s *Style) SetForegroundColor(c color.NRGBA)

type VirtualLine added in v0.0.9

type VirtualLine struct {
	// contains filtered or unexported fields
}

func (*VirtualLine) AddRun added in v0.0.9

func (v *VirtualLine) AddRun(tail Run)

func (VirtualLine) AppendLine added in v0.0.9

func (v VirtualLine) AppendLine(l2 Line) VirtualLine

func (VirtualLine) Length added in v0.0.9

func (v VirtualLine) Length() int

func (VirtualLine) Split added in v0.0.9

func (v VirtualLine) Split(maxLength int) []Line

func (*VirtualLine) Write added in v0.0.9

func (v *VirtualLine) Write(text string, x int, style Style)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL