vtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT 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 vtest is a small terminal for tests of what internal/tui/screen writes (ADR 0033).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VT

type VT struct {
	X, Y int

	Scrollback []string

	// NoPull: made taller, it adds blank rows below what it shows (as some
	// terminals do), instead of taking lines back from the scrollback.
	NoPull bool
	// contains filtered or unexported fields
}

VT is a small terminal for the tests: what the screen writes does to it what it does to a terminal (cursor moves, erasing, scroll regions, reverse scrolls, autowrap), with its scrollback. Cells hold one rune; a wide one (CJK) takes two, the second held by wideTail, and goes to the next row whole where only the last column is left, as terminals do. Colours are not kept (the tests write none).

func New

func New(w, h int) *VT

func (*VT) Lines

func (t *VT) Lines() []string

Lines are the scrollback, then what the terminal shows.

func (*VT) Resize

func (t *VT) Resize(w, h int)

Resize makes the terminal w × h as most terminals do (tmux, iTerm2, Ghostty): the lines it shows (rows joined where they wrapped) are wrapped again at w, the cursor kept on what it was on; what no longer fits goes up into the scrollback, and taller, lines come back from it. The scroll region is the whole terminal again.

func (*VT) Row

func (t *VT) Row(i int) string

Row is what row i shows, its trailing blanks cut.

func (*VT) Rows

func (t *VT) Rows() []string

Rows are what the terminal shows.

func (*VT) Write

func (t *VT) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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