terminalcontrol

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 2 Imported by: ? 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 terminalcontrol takes the terminal's controls out of stored or remote text, so that text cannot drive the terminal it is drawn on. OSC 52 in such text sets the clipboard, and CSI moves the cursor to hide lines on the screen or fake them. A program strips where it prints the text and keeps the stored value as written, as an HTML template escapes at render time. The package imports nothing that draws, so a command that only prints pays for no board.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Strip

func Strip(text string) string

Strip is text without its terminal controls. ESC opens a sequence, and the whole sequence leaves: CSI, OSC, DCS, SOS, PM, APC, or ESC with the bytes it takes. Every C0 and C1 control leaves too, and so does DEL. A C1 control leaves alone, as a code point or a byte outside any character, so the text after it stays. Text decoded in the wrong charset carries C1 code points, and a quote that turned into U+009D must not take the rest of a title with it. A newline and a tab stay, and each ends a sequence it falls inside, so the text keeps its lines however it is split. Text holding no control comes back as it was, with nothing allocated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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