[fix-hypercli-vendor] update hypercli dependency to github.com/Azure/go-ansiterm (#134)

This commit is contained in:
Jimmy Xu
2018-04-21 01:18:08 +08:00
committed by Robbie Zhang
parent 350bc670a6
commit 38ed39448a
3 changed files with 9 additions and 9 deletions

View File

@@ -136,14 +136,14 @@ func readInputEvents(fd uintptr, maxBytes int) ([]winterm.INPUT_RECORD, error) {
// KeyEvent Translation Helpers
var arrowKeyMapPrefix = map[winterm.WORD]string{
var arrowKeyMapPrefix = map[uint16]string{
winterm.VK_UP: "%s%sA",
winterm.VK_DOWN: "%s%sB",
winterm.VK_RIGHT: "%s%sC",
winterm.VK_LEFT: "%s%sD",
}
var keyMapPrefix = map[winterm.WORD]string{
var keyMapPrefix = map[uint16]string{
winterm.VK_UP: "\x1B[%sA",
winterm.VK_DOWN: "\x1B[%sB",
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.
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)
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.
func getControlKeys(controlState winterm.DWORD) (shift, alt, control bool) {
func getControlKeys(controlState uint32) (shift, alt, control bool) {
shift = 0 != (controlState & winterm.SHIFT_PRESSED)
alt = 0 != (controlState & (winterm.LEFT_ALT_PRESSED | winterm.RIGHT_ALT_PRESSED))
control = 0 != (controlState & (winterm.LEFT_CTRL_PRESSED | winterm.RIGHT_CTRL_PRESSED))