Change the SimpleTextInEx implementation to return CTRL+C when CTRL and C are both pressed; SimpleTextIn implementation still returns CTRL+3.

Signed-off-by: niruiyu
Reviewed-by: qianouyang

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12562 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2011-10-25 06:09:36 +00:00
parent c1ff10ec05
commit 9891f791b0
3 changed files with 23 additions and 21 deletions

View File

@ -1470,17 +1470,6 @@ KeyGetchar (
} }
} }
//
// Translate the CTRL-Alpha characters to their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A)
//
if (ConsoleIn->LeftCtrl || ConsoleIn->RightCtrl) {
if (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z') {
KeyData.Key.UnicodeChar = (UINT16) (KeyData.Key.UnicodeChar - L'a' + 1);
} else if (KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') {
KeyData.Key.UnicodeChar = (UINT16) (KeyData.Key.UnicodeChar - L'A' + 1);
}
}
PushEfikeyBufTail (&ConsoleIn->EfiKeyQueue, &KeyData); PushEfikeyBufTail (&ConsoleIn->EfiKeyQueue, &KeyData);
} }

View File

@ -288,6 +288,18 @@ KeyboardReadKeyStroke (
if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) { if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {
continue; continue;
} }
//
// Translate the CTRL-Alpha characters to their corresponding control value
// (ctrl-a = 0x0001 through ctrl-Z = 0x001A)
//
if ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) {
if (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'a' + 1);
} else if (KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'A' + 1);
}
}
CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY)); CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -1386,6 +1386,17 @@ BiosKeyboardReadKeyStroke (
return Status; return Status;
} }
//
// Convert the Ctrl+[a-z] to Ctrl+[1-26]
//
if ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) {
if (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'a' + 1);
} else if (KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') {
KeyData.Key.UnicodeChar = (CHAR16) (KeyData.Key.UnicodeChar - L'A' + 1);
}
}
CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY)); CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));
return EFI_SUCCESS; return EFI_SUCCESS;
@ -1938,16 +1949,6 @@ BiosKeyboardTimerHandler (
} }
} }
//
// Convert the Ctrl+[a-z] to Ctrl+[1-26]
//
if ((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) {
if (KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z') {
KeyData.Key.UnicodeChar = (UINT16) (KeyData.Key.UnicodeChar - L'a' + 1);
} else if (KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') {
KeyData.Key.UnicodeChar = (UINT16) (KeyData.Key.UnicodeChar - L'A' + 1);
}
}
Enqueue (&BiosKeyboardPrivate->Queue, &KeyData); Enqueue (&BiosKeyboardPrivate->Queue, &KeyData);
// //
// Leave critical section and return // Leave critical section and return