vterm

package
v0.0.0-...-7ba8725 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package vterm provides a layer of abstraction between a channel of incoming text (possibly containing ANSI escape codes, et al) and a channel of outbound Char's.

A Char is a character printed using a given cursor (which is stored alongside the Char).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScrollingRegion

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

ScrollingRegion holds the state for an ANSI scrolling region

type VTerm

type VTerm struct {

	// visible screen; char cursor coords are ignored
	Screen [][]render.Char

	// Scrollback[0] is the line farthest from the screen
	Scrollback    [][]render.Char // disabled when using alt screen; char cursor coords are ignored
	ScrollbackPos int             // ScrollbackPos is the number of lines of scrollback visible

	NeedsRedraw bool

	Cursor render.Cursor

	ChangePause   chan bool
	IsPaused      bool
	DebugSlowMode bool
	// contains filtered or unexported fields
}

VTerm acts as a virtual terminal emulator between a shell and the host terminal emulator

It both transforms an inbound stream of bytes into Char's and provides the option of dumping all the Char's that need to be rendered to display the currently visible terminal window from scratch.

func NewVTerm

func NewVTerm(shellByteCounter *uint64, renderer *render.Renderer, parentSetCursor func(x, y int), in <-chan rune, out chan<- rune) *VTerm

NewVTerm returns a VTerm ready to be used by its exported methods

func (*VTerm) Kill

func (v *VTerm) Kill()

Kill safely shuts down all vterm processes for the instance

func (*VTerm) ProcessStream

func (v *VTerm) ProcessStream()

ProcessStream processes and transforms a process' stdout, turning it into a stream of Char's to be sent to the rendering scheduler This includes translating ANSI Cursor coordinates and maintaining a scrolling buffer

func (*VTerm) RedrawWindow

func (v *VTerm) RedrawWindow()

RedrawWindow redraws the screen into ncurses from scratch. This should be reserved for operations not yet formalized into a generic, efficient function.

func (*VTerm) RefreshCursor

func (v *VTerm) RefreshCursor()

RefreshCursor refreshes the ncurses cursor position

func (*VTerm) Reshape

func (v *VTerm) Reshape(x, y, w, h int)

Reshape safely updates a VTerm's width & height

func (*VTerm) ScrollbackDown

func (v *VTerm) ScrollbackDown()

ScrollbackDown shifts the screen contents down, with scrollback

func (*VTerm) ScrollbackReset

func (v *VTerm) ScrollbackReset()

func (*VTerm) ScrollbackUp

func (v *VTerm) ScrollbackUp()

ScrollbackUp shifts the screen contents up, with scrollback

Jump to

Keyboard shortcuts

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