screen

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.0.20

type Client struct {
	SessionID string `json:"session_id"`
	// contains filtered or unexported fields
}

func NewClient added in v0.0.20

func NewClient(conn *websocket.Conn) *Client

func (*Client) Close added in v0.0.20

func (c *Client) Close()

func (*Client) IsClosed added in v0.0.22

func (c *Client) IsClosed() bool

IsClosed reports whether the client is closed.

func (*Client) Send added in v0.0.20

func (c *Client) Send(prefix byte, p []byte) (err error)

Send frames a message and queues it to the client's stream.

type Screen

type Screen struct {
	Columns int            `json:"columns"`
	Rows    int            `json:"rows"`
	Clients []*Client      `json:"-"`
	Stream  *stream.Stream `json:"-"`
	// contains filtered or unexported fields
}

Screen broadcasts a single terminal to every attached client. It keeps an authoritative in-memory terminal emulator so new clients can be brought to the current state.

mx guards Clients, Rows, and Columns. The emulator (mt) and the broadcast Stream are internally synchronized, so they are used without holding mx. The lock is never held while sending to a client.

func New

func New(rows, columns int) *Screen

func (*Screen) AttachClient added in v0.0.20

func (s *Screen) AttachClient(c *Client)

AttachClient attaches a client and brings it to the current screen state.

func (*Screen) CursorPos

func (s *Screen) CursorPos() (rows, columns int)

CursorPos returns the cursor position.

func (*Screen) GetScreenAsANSI

func (s *Screen) GetScreenAsANSI() []byte

GetScreenAsANSI returns the current screen content as ANSI.

func (*Screen) Read added in v0.0.19

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

func (*Screen) Resize

func (s *Screen) Resize(rows, columns int)

Resize resizes the screen and notifies attached clients.

func (*Screen) Write

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

Write implements io.Writer. It strips the host's clipboard sequences (OSC 52) and normalizes colon-form color SGR to the semicolon form every xterm.js renders correctly, then feeds the cleaned bytes to both the emulator and the broadcast stream.

Jump to

Keyboard shortcuts

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