tty

package
v0.0.0-...-dde8c00 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2017 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EscSequenceTimeout is the amount of time within which runes that make up
	// an escape sequence are supposed to follow each other. Modern terminal
	// emulators send escape sequences very fast, so 10ms is more than
	// sufficient. SSH connections on a slow link might be problematic though.
	EscSequenceTimeout = 10 * time.Millisecond
)

Functions

This section is empty.

Types

type AsyncReader

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

AsyncReader delivers a Unix fd stream to a channel of runes.

func NewAsyncReader

func NewAsyncReader(rd *os.File) *AsyncReader

NewAsyncReader creates a new AsyncReader from a file.

func (*AsyncReader) Chan

func (ar *AsyncReader) Chan() <-chan rune

Chan returns a channel onto which the AsyncReader writes the runes it reads.

func (*AsyncReader) Close

func (ar *AsyncReader) Close()

Close releases files and channels associated with the AsyncReader. It does not close the file used to create it.

func (*AsyncReader) ErrorChan

func (ar *AsyncReader) ErrorChan() <-chan error

ErrorChan returns a channel onto which the AsyncReader writes the errors it encounters.

func (*AsyncReader) Quit

func (ar *AsyncReader) Quit()

Quit terminates the loop of Run.

func (*AsyncReader) Run

func (ar *AsyncReader) Run()

Run runs the AsyncReader. It blocks until Quit is called and should be called in a separate goroutine.

type CursorPosition

type CursorPosition Pos

type Key

type Key ui.Key

type MouseEvent

type MouseEvent struct {
	Pos
	Down bool
	// Number of the Button, 0-based. -1 for unknown.
	Button int
	Mod    ui.Mod
}

type PasteSetting

type PasteSetting bool

type Pos

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

Pos is the position in a terminal.

type RawRune

type RawRune rune

type ReadUnit

type ReadUnit interface {
	// contains filtered or unexported methods
}

ReadUnit represents one "thing" that the Reader has read. It is one of the following: RawRune (when the reader is in the raw mode), Key, CursorPosition, MouseEvent, or PasteSetting.

type Reader

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

Reader converts a stream of events on separate channels.

func NewReader

func NewReader(f *os.File) *Reader

NewReader creates a new Reader on the given terminal file.

func (*Reader) Close

func (rd *Reader) Close()

Close releases files associated with the Reader. It does not close the file used to create it.

func (*Reader) ErrorChan

func (rd *Reader) ErrorChan() <-chan error

ErrorChan returns the channel onto which the Reader writes errors it came across during the reading process.

func (*Reader) Quit

func (rd *Reader) Quit()

Quit terminates the loop of Run.

func (*Reader) Run

func (rd *Reader) Run()

Run runs the Reader. It blocks until Quit is called and should be called in a separate goroutine.

func (*Reader) SetRaw

func (rd *Reader) SetRaw(raw bool)

SetRaw turns the raw option on or off. If the reader is in the middle of reading one event, it takes effect after this event is fully read.

func (*Reader) UnitChan

func (rd *Reader) UnitChan() <-chan ReadUnit

UnitChan returns the channel onto which the Reader writes what it has read.

Notes

Bugs

  • AsyncReader relies on the undocumented fact that (*os.File).Read returns an *os.File.PathError

Jump to

Keyboard shortcuts

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