winterm

package
v0.7.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2016 License: MIT, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	VK_PRIOR    = 0x21 // PAGE UP key
	VK_NEXT     = 0x22 // PAGE DOWN key
	VK_END      = 0x23 // END key
	VK_HOME     = 0x24 // HOME key
	VK_LEFT     = 0x25 // LEFT ARROW key
	VK_UP       = 0x26 // UP ARROW key
	VK_RIGHT    = 0x27 // RIGHT ARROW key
	VK_DOWN     = 0x28 // DOWN ARROW key
	VK_SELECT   = 0x29 // SELECT key
	VK_PRINT    = 0x2A // PRINT key
	VK_EXECUTE  = 0x2B // EXECUTE key
	VK_SNAPSHOT = 0x2C // PRINT SCREEN key
	VK_INSERT   = 0x2D // INS key
	VK_DELETE   = 0x2E // DEL key
	VK_HELP     = 0x2F // HELP key
	VK_F1       = 0x70 // F1 key
	VK_F2       = 0x71 // F2 key
	VK_F3       = 0x72 // F3 key
	VK_F4       = 0x73 // F4 key
	VK_F5       = 0x74 // F5 key
	VK_F6       = 0x75 // F6 key
	VK_F7       = 0x76 // F7 key
	VK_F8       = 0x77 // F8 key
	VK_F9       = 0x78 // F9 key
	VK_F10      = 0x79 // F10 key
	VK_F11      = 0x7A // F11 key
	VK_F12      = 0x7B // F12 key

	RIGHT_ALT_PRESSED  = 0x0001
	LEFT_ALT_PRESSED   = 0x0002
	RIGHT_CTRL_PRESSED = 0x0004
	LEFT_CTRL_PRESSED  = 0x0008
	SHIFT_PRESSED      = 0x0010
	NUMLOCK_ON         = 0x0020
	SCROLLLOCK_ON      = 0x0040
	CAPSLOCK_ON        = 0x0080
	ENHANCED_KEY       = 0x0100
)

Windows keyboard constants See https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx.

View Source
const (
	// Console modes
	// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx.
	ENABLE_PROCESSED_INPUT = 0x0001
	ENABLE_LINE_INPUT      = 0x0002
	ENABLE_ECHO_INPUT      = 0x0004
	ENABLE_WINDOW_INPUT    = 0x0008
	ENABLE_MOUSE_INPUT     = 0x0010
	ENABLE_INSERT_MODE     = 0x0020
	ENABLE_QUICK_EDIT_MODE = 0x0040
	ENABLE_EXTENDED_FLAGS  = 0x0080

	ENABLE_PROCESSED_OUTPUT   = 0x0001
	ENABLE_WRAP_AT_EOL_OUTPUT = 0x0002

	// Character attributes
	// Note:
	// -- The attributes are combined to produce various colors (e.g., Blue + Green will create Cyan).
	//    Clearing all foreground or background colors results in black; setting all creates white.
	// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682088(v=vs.85).aspx#_win32_character_attributes.
	FOREGROUND_BLUE      WORD = 0x0001
	FOREGROUND_GREEN     WORD = 0x0002
	FOREGROUND_RED       WORD = 0x0004
	FOREGROUND_INTENSITY WORD = 0x0008
	FOREGROUND_MASK      WORD = 0x000F

	BACKGROUND_BLUE      WORD = 0x0010
	BACKGROUND_GREEN     WORD = 0x0020
	BACKGROUND_RED       WORD = 0x0040
	BACKGROUND_INTENSITY WORD = 0x0080
	BACKGROUND_MASK      WORD = 0x00F0

	COMMON_LVB_MASK          WORD = 0xFF00
	COMMON_LVB_REVERSE_VIDEO WORD = 0x4000
	COMMON_LVB_UNDERSCORE    WORD = 0x8000

	// Input event types
	// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms683499(v=vs.85).aspx.
	KEY_EVENT                = 0x0001
	MOUSE_EVENT              = 0x0002
	WINDOW_BUFFER_SIZE_EVENT = 0x0004
	MENU_EVENT               = 0x0008
	FOCUS_EVENT              = 0x0010

	// WaitForSingleObject return codes
	WAIT_ABANDONED = 0x00000080
	WAIT_FAILED    = 0xFFFFFFFF
	WAIT_SIGNALED  = 0x0000000
	WAIT_TIMEOUT   = 0x00000102

	// WaitForSingleObject wait duration
	WAIT_INFINITE       = 0xFFFFFFFF
	WAIT_ONE_SECOND     = 1000
	WAIT_HALF_SECOND    = 500
	WAIT_QUARTER_SECOND = 250
)

Windows Console constants

View Source
const (
	FOREGROUND_COLOR_MASK = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
	BACKGROUND_COLOR_MASK = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE
)
View Source
const (
	Horizontal = iota
	Vertical
)

Variables

This section is empty.

Functions

func CreateWinEventHandler

func CreateWinEventHandler(fd uintptr, file *os.File) AnsiEventHandler

func GetConsoleCursorInfo

func GetConsoleCursorInfo(handle uintptr, cursorInfo *CONSOLE_CURSOR_INFO) error

GetConsoleCursorInfo retrieves information about the size and visiblity of the console cursor. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms683163(v=vs.85).aspx.

func GetConsoleMode

func GetConsoleMode(handle uintptr) (mode uint32, err error)

GetConsoleMode gets the console mode for given file descriptor See http://msdn.microsoft.com/en-us/library/windows/desktop/ms683167(v=vs.85).aspx.

func GetStdFile

func GetStdFile(nFile int) (*os.File, uintptr)

func ReadConsoleInput

func ReadConsoleInput(handle uintptr, buffer []INPUT_RECORD, count *uint32) error

ReadConsoleInput reads (and removes) data from the console input buffer. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684961(v=vs.85).aspx.

func ScrollConsoleScreenBuffer

func ScrollConsoleScreenBuffer(handle uintptr, scrollRect SMALL_RECT, clipRect SMALL_RECT, destOrigin COORD, char CHAR_INFO) error

func SetConsoleCursorInfo

func SetConsoleCursorInfo(handle uintptr, cursorInfo *CONSOLE_CURSOR_INFO) error

SetConsoleCursorInfo sets the size and visiblity of the console cursor. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686019(v=vs.85).aspx.

func SetConsoleCursorPosition

func SetConsoleCursorPosition(handle uintptr, coord COORD) error

SetConsoleCursorPosition location of the console cursor. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686025(v=vs.85).aspx.

func SetConsoleMode

func SetConsoleMode(handle uintptr, mode uint32) error

SetConsoleMode sets the console mode for given file descriptor See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx.

func SetConsoleScreenBufferSize

func SetConsoleScreenBufferSize(handle uintptr, coord COORD) error

SetConsoleScreenBufferSize sets the size of the console screen buffer. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686044(v=vs.85).aspx.

func SetConsoleTextAttribute

func SetConsoleTextAttribute(handle uintptr, attribute WORD) error

SetConsoleTextAttribute sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole function. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686047(v=vs.85).aspx.

func SetConsoleWindowInfo

func SetConsoleWindowInfo(handle uintptr, isAbsolute bool, rect SMALL_RECT) error

SetConsoleWindowInfo sets the size and position of the console screen buffer's window. Note that the size and location must be within and no larger than the backing console screen buffer. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms686125(v=vs.85).aspx.

func WaitForSingleObject

func WaitForSingleObject(handle uintptr, msWait uint32) (bool, error)

WaitForSingleObject waits for the passed handle to be signaled. It returns true if the handle was signaled; false otherwise. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx.

func WriteConsoleOutput

func WriteConsoleOutput(handle uintptr, buffer []CHAR_INFO, bufferSize COORD, bufferCoord COORD, writeRegion *SMALL_RECT) error

WriteConsoleOutput writes the CHAR_INFOs from the provided buffer to the active console buffer. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms687404(v=vs.85).aspx.

Types

type BOOL

type BOOL int32

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type CHAR_INFO

type CHAR_INFO struct {
	UnicodeChar WCHAR
	Attributes  WORD
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type CONSOLE_CURSOR_INFO

type CONSOLE_CURSOR_INFO struct {
	Size    DWORD
	Visible BOOL
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type CONSOLE_SCREEN_BUFFER_INFO

type CONSOLE_SCREEN_BUFFER_INFO struct {
	Size              COORD
	CursorPosition    COORD
	Attributes        WORD
	Window            SMALL_RECT
	MaximumWindowSize COORD
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

func GetConsoleScreenBufferInfo

func GetConsoleScreenBufferInfo(handle uintptr) (*CONSOLE_SCREEN_BUFFER_INFO, error)

GetConsoleScreenBufferInfo retrieves information about the specified console screen buffer. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms683171(v=vs.85).aspx.

func (CONSOLE_SCREEN_BUFFER_INFO) String

func (info CONSOLE_SCREEN_BUFFER_INFO) String() string

String helpers

type COORD

type COORD struct {
	X SHORT
	Y SHORT
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

func (COORD) String

func (coord COORD) String() string

type DWORD

type DWORD uint32

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type INPUT_RECORD

type INPUT_RECORD struct {
	EventType WORD
	KeyEvent  KEY_EVENT_RECORD
}

INPUT_RECORD is a C/C++ union of which KEY_EVENT_RECORD is one case, it is also the largest See https://msdn.microsoft.com/en-us/library/windows/desktop/ms683499(v=vs.85).aspx.

type KEY_EVENT_RECORD

type KEY_EVENT_RECORD struct {
	KeyDown         BOOL
	RepeatCount     WORD
	VirtualKeyCode  WORD
	VirtualScanCode WORD
	UnicodeChar     WCHAR
	ControlKeyState DWORD
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type SHORT

type SHORT int16

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

func AddInRange

func AddInRange(n SHORT, increment SHORT, min SHORT, max SHORT) SHORT

AddInRange increments a value by the passed quantity while ensuring the values always remain within the supplied min / max range.

type SMALL_RECT

type SMALL_RECT struct {
	Left   SHORT
	Top    SHORT
	Right  SHORT
	Bottom SHORT
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

func (SMALL_RECT) String

func (rect SMALL_RECT) String() string

type WCHAR

type WCHAR uint16

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type WINDOW_BUFFER_SIZE

type WINDOW_BUFFER_SIZE struct {
	Size COORD
}

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type WORD

type WORD uint16

Windows API Console types -- See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for core types (e.g., SHORT) -- See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682101(v=vs.85).aspx for Console specific types (e.g., COORD) -- See https://msdn.microsoft.com/en-us/library/aa296569(v=vs.60).aspx for comments on alignment

type WindowsAnsiEventHandler

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

func (*WindowsAnsiEventHandler) CHA

func (h *WindowsAnsiEventHandler) CHA(param int) error

func (*WindowsAnsiEventHandler) CNL

func (h *WindowsAnsiEventHandler) CNL(param int) error

func (*WindowsAnsiEventHandler) CPL

func (h *WindowsAnsiEventHandler) CPL(param int) error

func (*WindowsAnsiEventHandler) CUB

func (h *WindowsAnsiEventHandler) CUB(param int) error

func (*WindowsAnsiEventHandler) CUD

func (h *WindowsAnsiEventHandler) CUD(param int) error

func (*WindowsAnsiEventHandler) CUF

func (h *WindowsAnsiEventHandler) CUF(param int) error

func (*WindowsAnsiEventHandler) CUP

func (h *WindowsAnsiEventHandler) CUP(row int, col int) error

func (*WindowsAnsiEventHandler) CUU

func (h *WindowsAnsiEventHandler) CUU(param int) error

func (*WindowsAnsiEventHandler) DA

func (h *WindowsAnsiEventHandler) DA(params []string) error

func (*WindowsAnsiEventHandler) DCH

func (h *WindowsAnsiEventHandler) DCH(param int) error

func (*WindowsAnsiEventHandler) DECCOLM

func (h *WindowsAnsiEventHandler) DECCOLM(use132 bool) error

func (*WindowsAnsiEventHandler) DECOM

func (h *WindowsAnsiEventHandler) DECOM(enable bool) error

func (*WindowsAnsiEventHandler) DECSTBM

func (h *WindowsAnsiEventHandler) DECSTBM(top int, bottom int) error

func (*WindowsAnsiEventHandler) DECTCEM

func (h *WindowsAnsiEventHandler) DECTCEM(visible bool) error

func (*WindowsAnsiEventHandler) DL

func (h *WindowsAnsiEventHandler) DL(param int) error

func (*WindowsAnsiEventHandler) ED

func (h *WindowsAnsiEventHandler) ED(param int) error

func (*WindowsAnsiEventHandler) EL

func (h *WindowsAnsiEventHandler) EL(param int) error

func (*WindowsAnsiEventHandler) Execute

func (h *WindowsAnsiEventHandler) Execute(b byte) error

func (*WindowsAnsiEventHandler) Flush

func (h *WindowsAnsiEventHandler) Flush() error

func (*WindowsAnsiEventHandler) HVP

func (h *WindowsAnsiEventHandler) HVP(row int, col int) error

func (*WindowsAnsiEventHandler) ICH

func (h *WindowsAnsiEventHandler) ICH(param int) error

func (*WindowsAnsiEventHandler) IL

func (h *WindowsAnsiEventHandler) IL(param int) error

func (*WindowsAnsiEventHandler) IND

func (h *WindowsAnsiEventHandler) IND() error

func (*WindowsAnsiEventHandler) Print

func (h *WindowsAnsiEventHandler) Print(b byte) error

func (*WindowsAnsiEventHandler) RI

func (*WindowsAnsiEventHandler) SD

func (h *WindowsAnsiEventHandler) SD(param int) error

func (*WindowsAnsiEventHandler) SGR

func (h *WindowsAnsiEventHandler) SGR(params []int) error

func (*WindowsAnsiEventHandler) SU

func (h *WindowsAnsiEventHandler) SU(param int) error

func (*WindowsAnsiEventHandler) VPA

func (h *WindowsAnsiEventHandler) VPA(param int) error

Jump to

Keyboard shortcuts

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