mock

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: Apache-2.0 Imports: 1 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    tcell.Color
	Bg    tcell.Color
	Attr  tcell.AttrMask
	Width int // Display width of C.
}

type MockTty

type MockTty struct {
	Cells []Cell // Content of cells
	Rows  int
	Cols  int
	Fg    tcell.Color
	Bg    tcell.Color

	X int // cursor position
	Y int // cursor position

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

	PrimaryAttributes  string // Primary device attributes, response to CSI-c
	ExtendedAttributes string // Extended attributes (term name, etc.) response to CSI > q
	// contains filtered or unexported fields
}

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