termbuf

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package termbuf holds the recent output of a terminal: the last bytes it printed plus the terminal modes that output set, so a terminal that attaches late can be put back into the state the program expects.

Two places keep one. The daemon keeps one per owned session for the browser tabs that connect to it, and the pty-host process (internal/ptyhost) keeps one for the daemon itself — after a daemon restart, that buffer is the only record of what the screen looked like.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring

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

Ring is a fixed-size byte buffer holding the most recent terminal output, so a terminal that connects late still sees recent scrollback — and the terminal modes that output set, which may have long since scrolled out of it.

func NewRing

func NewRing(size int) *Ring

NewRing returns a ring that keeps the last size bytes.

func (*Ring) Snapshot

func (r *Ring) Snapshot() []byte

Snapshot is what a terminal attaching now should be sent: the mode prefix, then the scrollback.

func (*Ring) Write

func (r *Ring) Write(p []byte)

Write appends output, dropping the oldest bytes past the ring's size.

Jump to

Keyboard shortcuts

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