Windows: revendor Azure/go-ansiterm

go-ansiterm was previously pulling the testing package into the docker
binaries.

Signed-off-by: John Starks <jostarks@microsoft.com>
This commit is contained in:
John Starks 2016-04-25 15:55:12 -07:00
parent 9333729a55
commit d7a00d191f

View file

@ -136,14 +136,14 @@ func readInputEvents(fd uintptr, maxBytes int) ([]winterm.INPUT_RECORD, error) {
// KeyEvent Translation Helpers // KeyEvent Translation Helpers
var arrowKeyMapPrefix = map[winterm.WORD]string{ var arrowKeyMapPrefix = map[uint16]string{
winterm.VK_UP: "%s%sA", winterm.VK_UP: "%s%sA",
winterm.VK_DOWN: "%s%sB", winterm.VK_DOWN: "%s%sB",
winterm.VK_RIGHT: "%s%sC", winterm.VK_RIGHT: "%s%sC",
winterm.VK_LEFT: "%s%sD", winterm.VK_LEFT: "%s%sD",
} }
var keyMapPrefix = map[winterm.WORD]string{ var keyMapPrefix = map[uint16]string{
winterm.VK_UP: "\x1B[%sA", winterm.VK_UP: "\x1B[%sA",
winterm.VK_DOWN: "\x1B[%sB", winterm.VK_DOWN: "\x1B[%sB",
winterm.VK_RIGHT: "\x1B[%sC", winterm.VK_RIGHT: "\x1B[%sC",
@ -207,7 +207,7 @@ func keyToString(keyEvent *winterm.KEY_EVENT_RECORD, escapeSequence []byte) stri
} }
// formatVirtualKey converts a virtual key (e.g., up arrow) into the appropriate ANSI string. // formatVirtualKey converts a virtual key (e.g., up arrow) into the appropriate ANSI string.
func formatVirtualKey(key winterm.WORD, controlState winterm.DWORD, escapeSequence []byte) string { func formatVirtualKey(key uint16, controlState uint32, escapeSequence []byte) string {
shift, alt, control := getControlKeys(controlState) shift, alt, control := getControlKeys(controlState)
modifier := getControlKeysModifier(shift, alt, control) modifier := getControlKeysModifier(shift, alt, control)
@ -223,7 +223,7 @@ func formatVirtualKey(key winterm.WORD, controlState winterm.DWORD, escapeSequen
} }
// getControlKeys extracts the shift, alt, and ctrl key states. // getControlKeys extracts the shift, alt, and ctrl key states.
func getControlKeys(controlState winterm.DWORD) (shift, alt, control bool) { func getControlKeys(controlState uint32) (shift, alt, control bool) {
shift = 0 != (controlState & winterm.SHIFT_PRESSED) shift = 0 != (controlState & winterm.SHIFT_PRESSED)
alt = 0 != (controlState & (winterm.LEFT_ALT_PRESSED | winterm.RIGHT_ALT_PRESSED)) alt = 0 != (controlState & (winterm.LEFT_ALT_PRESSED | winterm.RIGHT_ALT_PRESSED))
control = 0 != (controlState & (winterm.LEFT_CTRL_PRESSED | winterm.RIGHT_CTRL_PRESSED)) control = 0 != (controlState & (winterm.LEFT_CTRL_PRESSED | winterm.RIGHT_CTRL_PRESSED))