buffer

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: GPL-3.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

func NewBuffer

func NewBuffer(terminalState *TerminalState) *Buffer

NewBuffer creates a new terminal buffer

func (*Buffer) Backspace

func (buffer *Buffer) Backspace()

func (*Buffer) BottomMargin

func (buffer *Buffer) BottomMargin() uint

func (*Buffer) CarriageReturn

func (buffer *Buffer) CarriageReturn()

func (*Buffer) Clear

func (buffer *Buffer) Clear()

func (*Buffer) ClearSelection added in v0.8.9

func (buffer *Buffer) ClearSelection()

func (*Buffer) Compare added in v0.8.8

func (buffer *Buffer) Compare(path string) bool

func (*Buffer) CursorAttr

func (buffer *Buffer) CursorAttr() *CellAttributes

func (*Buffer) CursorColumn

func (buffer *Buffer) CursorColumn() uint16

Column returns cursor column

func (*Buffer) CursorLine

func (buffer *Buffer) CursorLine() uint16

CursorLine returns cursor line (in Origin Mode it is relative to the top margin)

func (*Buffer) CursorLineAbsolute added in v0.9.0

func (buffer *Buffer) CursorLineAbsolute() uint16

CursorLineAbsolute returns absolute cursor line coordinate (ignoring Origin Mode)

func (*Buffer) DeleteChars

func (buffer *Buffer) DeleteChars(n int)

func (*Buffer) DeleteLines

func (buffer *Buffer) DeleteLines(count int)

func (*Buffer) EraseCharacters

func (buffer *Buffer) EraseCharacters(n int)

func (*Buffer) EraseDisplay

func (buffer *Buffer) EraseDisplay()

func (*Buffer) EraseDisplayFromCursor

func (buffer *Buffer) EraseDisplayFromCursor()

func (*Buffer) EraseDisplayToCursor

func (buffer *Buffer) EraseDisplayToCursor()

func (*Buffer) EraseLine

func (buffer *Buffer) EraseLine()

func (*Buffer) EraseLineFromCursor

func (buffer *Buffer) EraseLineFromCursor()

func (*Buffer) EraseLineToCursor

func (buffer *Buffer) EraseLineToCursor()

func (*Buffer) ExtendSelection added in v0.9.0

func (buffer *Buffer) ExtendSelection(col uint16, viewRow uint16, complete bool)

func (*Buffer) GetCell

func (buffer *Buffer) GetCell(viewCol uint16, viewRow uint16) *Cell

func (*Buffer) GetHintAtPosition

func (buffer *Buffer) GetHintAtPosition(col uint16, viewRow uint16) *hints.Hint

func (*Buffer) GetRawCell added in v0.7.2

func (buffer *Buffer) GetRawCell(viewCol uint16, rawLine uint64) *Cell

func (*Buffer) GetScrollOffset

func (buffer *Buffer) GetScrollOffset() uint

func (*Buffer) GetSelectedText

func (buffer *Buffer) GetSelectedText() string

func (*Buffer) GetURLAtPosition

func (buffer *Buffer) GetURLAtPosition(col uint16, viewRow uint16) string

func (*Buffer) GetVisibleLines

func (buffer *Buffer) GetVisibleLines() []Line

func (*Buffer) HasScrollableRegion

func (buffer *Buffer) HasScrollableRegion() bool

func (*Buffer) Height

func (buffer *Buffer) Height() int

func (*Buffer) InScrollableRegion

func (buffer *Buffer) InScrollableRegion() bool

func (*Buffer) InSelection

func (buffer *Buffer) InSelection(col uint16, row uint16) bool

func (*Buffer) Index

func (buffer *Buffer) Index()

func (*Buffer) InsertBlankCharacters

func (buffer *Buffer) InsertBlankCharacters(count int)

func (*Buffer) InsertLines

func (buffer *Buffer) InsertLines(count int)

func (*Buffer) IsDirty

func (buffer *Buffer) IsDirty() bool

func (*Buffer) IsNewLineMode added in v0.8.8

func (buffer *Buffer) IsNewLineMode() bool

func (*Buffer) IsSelectionComplete added in v0.9.0

func (buffer *Buffer) IsSelectionComplete() bool

func (*Buffer) MovePosition

func (buffer *Buffer) MovePosition(x int16, y int16)

func (*Buffer) NewLine

func (buffer *Buffer) NewLine()

func (*Buffer) NewLineEx added in v0.8.8

func (buffer *Buffer) NewLineEx(forceCursorToMargin bool)

func (*Buffer) RawLine

func (buffer *Buffer) RawLine() uint64

translates the cursor line to the raw buffer line

func (*Buffer) ResizeView

func (buffer *Buffer) ResizeView(width uint16, height uint16)

func (*Buffer) RestoreCursor

func (buffer *Buffer) RestoreCursor()

func (*Buffer) ReverseIndex

func (buffer *Buffer) ReverseIndex()

func (*Buffer) ReverseVideo added in v0.9.0

func (buffer *Buffer) ReverseVideo()

func (*Buffer) Save added in v0.8.8

func (buffer *Buffer) Save(path string)

func (*Buffer) SaveCursor

func (buffer *Buffer) SaveCursor()

func (*Buffer) ScrollDown

func (buffer *Buffer) ScrollDown(lines uint16)

func (*Buffer) ScrollPageDown

func (buffer *Buffer) ScrollPageDown()

func (*Buffer) ScrollPageUp

func (buffer *Buffer) ScrollPageUp()

func (*Buffer) ScrollToEnd

func (buffer *Buffer) ScrollToEnd()

func (*Buffer) ScrollUp

func (buffer *Buffer) ScrollUp(lines uint16)

func (*Buffer) SetPosition

func (buffer *Buffer) SetPosition(col uint16, line uint16)

func (*Buffer) StartSelection

func (buffer *Buffer) StartSelection(col uint16, viewRow uint16, mode SelectionMode)

func (*Buffer) Tab

func (buffer *Buffer) Tab()

func (*Buffer) TopMargin

func (buffer *Buffer) TopMargin() uint

func (*Buffer) ViewHeight

func (buffer *Buffer) ViewHeight() uint16

func (*Buffer) ViewWidth

func (buffer *Buffer) ViewWidth() uint16

func (*Buffer) Width

func (buffer *Buffer) Width() uint16

Width returns the width of the buffer in columns

func (*Buffer) Write

func (buffer *Buffer) Write(runes ...rune)

Write will write a rune to the terminal at the position of the cursor, and increment the cursor position

type Cell

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

func NewBackgroundCell

func NewBackgroundCell(colour [3]float32) Cell

func (*Cell) Attr

func (cell *Cell) Attr() CellAttributes

func (*Cell) Bg

func (cell *Cell) Bg() [3]float32

func (*Cell) Fg

func (cell *Cell) Fg() [3]float32

func (*Cell) Image

func (cell *Cell) Image() *image.RGBA

func (*Cell) Rune

func (cell *Cell) Rune() rune

func (*Cell) SetImage

func (cell *Cell) SetImage(img *image.RGBA)

type CellAttributes

type CellAttributes struct {
	FgColour  [3]float32
	BgColour  [3]float32
	Bold      bool
	Dim       bool
	Underline bool
	Blink     bool
	Inverse   bool
	Hidden    bool
}

func (*CellAttributes) ReverseVideo added in v0.9.0

func (cellAttr *CellAttributes) ReverseVideo()

type Line

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

func (*Line) Cells

func (line *Line) Cells() []Cell

func (*Line) Cleanse

func (line *Line) Cleanse()

Cleanse removes null bytes from the end of the row

func (*Line) CutCellsAfter

func (line *Line) CutCellsAfter(n int) []Cell

@todo test these (ported from legacy) ------------------

func (*Line) CutCellsFromBeginning

func (line *Line) CutCellsFromBeginning(n int) []Cell

func (*Line) CutCellsFromEnd

func (line *Line) CutCellsFromEnd(n int) []Cell

func (*Line) ReverseVideo added in v0.9.0

func (line *Line) ReverseVideo()

func (*Line) String

func (line *Line) String() string

type Position

type Position struct {
	Line int
	Col  int
}

type SelectionMode added in v0.9.0

type SelectionMode int
const (
	SelectionChar SelectionMode = iota // char-by-char selection
	SelectionWord SelectionMode = iota // by word selection
	SelectionLine SelectionMode = iota // whole line selection
)

type TerminalState added in v0.8.9

type TerminalState struct {
	CursorAttr CellAttributes

	ReplaceMode  bool // overwrite character at cursor or insert new
	OriginMode   bool // see DECOM docs - whether cursor is positioned within the margins or not
	LineFeedMode bool
	ScreenMode   bool // DECSCNM (black on white background)
	AutoWrap     bool

	Charsets       []*map[rune]rune // array of 2 charsets, nil means ASCII (no conversion)
	CurrentCharset int              // active charset index in Charsets array, valid values are 0 or 1
	// contains filtered or unexported fields
}

func NewTerminalState added in v0.8.9

func NewTerminalState(viewCols uint16, viewLines uint16, attr CellAttributes, maxLines uint64) *TerminalState

NewTerminalMode creates a new terminal state

func (*TerminalState) DefaultCell added in v0.9.0

func (terminalState *TerminalState) DefaultCell(applyEffects bool) Cell

func (*TerminalState) IsNewLineMode added in v0.8.9

func (terminalState *TerminalState) IsNewLineMode() bool

func (*TerminalState) IsTabSetAtCursor added in v0.8.9

func (terminalState *TerminalState) IsTabSetAtCursor() bool

func (*TerminalState) ResetVerticalMargins added in v0.8.9

func (terminalState *TerminalState) ResetVerticalMargins()

ResetVerticalMargins resets margins to extreme positions

func (*TerminalState) SetVerticalMargins added in v0.8.9

func (terminalState *TerminalState) SetVerticalMargins(top uint, bottom uint)

func (*TerminalState) TabClear added in v0.8.9

func (terminalState *TerminalState) TabClear(index uint16)

func (*TerminalState) TabClearAtCursor added in v0.8.9

func (terminalState *TerminalState) TabClearAtCursor()

func (*TerminalState) TabReset added in v0.8.9

func (terminalState *TerminalState) TabReset()

func (*TerminalState) TabSet added in v0.8.9

func (terminalState *TerminalState) TabSet(index uint16)

func (*TerminalState) TabSetAtCursor added in v0.8.9

func (terminalState *TerminalState) TabSetAtCursor()

func (*TerminalState) TabZonk added in v0.8.9

func (terminalState *TerminalState) TabZonk()

Jump to

Keyboard shortcuts

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