xterminal

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package xterminal provides functions to change termios or console attributes and restore them later on. It supports Unix and Windows.

This does the same thing as x/crypto/ssh/terminal on Linux. On Windows, it sets the same console modes as the terminal package but also sets `ENABLE_VIRTUAL_TERMINAL_INPUT` and `ENABLE_VIRTUAL_TERMINAL_PROCESSING` to allow for VT100 sequences in the console. This is important, otherwise Linux apps (with colors or ncurses) that are run through SSH or wsep get garbled in a Windows console.

More details can be found out about Windows console modes here: https://docs.microsoft.com/en-us/windows/console/setconsolemode

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorEnabled

func ColorEnabled(handle uintptr) (bool, error)

ColorEnabled returns true if VT100 processing is enabled on the output console.

func ResizeEvents

func ResizeEvents(ctx context.Context, termfd uintptr) chan ResizeEvent

ResizeEvents sends terminal resize events when the dimensions change. Windows does not have a unix.SIGWINCH equivalent, so we poll the terminal size at a fixed interval

func Restore

func Restore(handle uintptr, state *State) error

Restore terminal back to original state.

Types

type ResizeEvent

type ResizeEvent struct {
	Height, Width uint16
}

type State

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

State differs per-platform.

func MakeOutputRaw

func MakeOutputRaw(handle uintptr) (*State, error)

MakeOutputRaw sets an output terminal to raw and enables VT100 processing.

func MakeRaw

func MakeRaw(handle uintptr) (*State, error)

MakeRaw sets an input terminal to raw and enables VT100 processing.

Jump to

Keyboard shortcuts

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