mock

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package mock is a simulated terminal (a terminal emulator if you will!) that is intended to be used for testing tcell. As this package is for internal testing of tcell, it carries no stability promise.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	C     []rune // Content, for now only a single rune is supported
	Fg    color.Color
	Bg    color.Color
	Attr  tcell.AttrMask
	Width int // Display width of C.
}

Cell is a representation of a display cell.

type MockTty

type MockTty struct {
	Cells []Cell // Content of cells
	Rows  vt.Row
	Cols  vt.Col
	Fg    color.Color
	Bg    color.Color
	Attr  tcell.AttrMask
	X     vt.Col // cursor horizontal position
	Y     vt.Row // cursor vertical position
	Bells int    // incremented each time the bell is sounded

	ReadQ  chan any // contents of stdin
	WriteQ chan any // contents of stdout

	PrimaryAttributes   string // Primary device attributes, response to CSI-c
	SecondaryAttributes string // Secondary device attributes, response to CSI-c
	ExtendedAttributes  string // Extended attributes (term name, etc.) response to CSI > q
	PrivateModes        map[vt.PrivateMode]vt.ModeStatus
	// contains filtered or unexported fields
}

MockTty is a mock terminal device.

func (*MockTty) Close

func (mt *MockTty) Close() error

func (*MockTty) Drain

func (mt *MockTty) Drain() error

func (*MockTty) NotifyResize

func (mt *MockTty) NotifyResize(rq chan<- bool)

func (*MockTty) Read

func (mt *MockTty) Read(b []byte) (int, error)

func (*MockTty) Reset

func (mt *MockTty) Reset()

Reset is not part of the TTY interface, and is for testing.

func (*MockTty) Start

func (mt *MockTty) Start() error

func (*MockTty) Stop

func (mt *MockTty) Stop() error

func (*MockTty) WindowSize

func (mt *MockTty) WindowSize() (tcell.WindowSize, error)

func (*MockTty) Write

func (mt *MockTty) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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