ShellPkg/[hex]edit: Fix CTRL+<Alpha> doesn't work from hyper terminal
After commit20ddbc133f
* MdeModulePkg/ConSplitter: ReadKeyStrokeEx always return key state When one physical console supports to report the shift key state, the key data returned from ConSplitter driver at least carries the shift key valid bit. The patch fixes the edit/hexedit to accept Unicode (1) when the no shift key is pressed or reported. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> (cherry picked from commit7cb0313359
)
This commit is contained in:
@ -1387,18 +1387,20 @@ MainCommandDisplayHelp (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) {
|
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
|
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
||||||
//
|
//
|
||||||
// For consoles that don't support shift state reporting,
|
// For consoles that don't support/report shift state,
|
||||||
// CTRL+W is translated to L'W' - L'A' + 1.
|
// CTRL+W is translated to L'W' - L'A' + 1.
|
||||||
//
|
//
|
||||||
if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) {
|
if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
|
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
||||||
//
|
//
|
||||||
// For consoles that supports shift state reporting,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure that only CONTROL shift key is pressed.
|
// make sure that only CONTROL shift key is pressed.
|
||||||
//
|
//
|
||||||
if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) {
|
if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) {
|
||||||
|
@ -183,16 +183,18 @@ MenuBarDispatchControlHotKey (
|
|||||||
//
|
//
|
||||||
ControlIndex = MAX_UINT16;
|
ControlIndex = MAX_UINT16;
|
||||||
|
|
||||||
if ((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) {
|
if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
|
(KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
||||||
//
|
//
|
||||||
// For those console devices that cannot report the CONTROL state,
|
// For consoles that don't support/report shift state,
|
||||||
// Ctrl+A is translated to 1 (UnicodeChar).
|
// Ctrl+A is translated to 1 (UnicodeChar).
|
||||||
//
|
//
|
||||||
ControlIndex = KeyData->Key.UnicodeChar;
|
ControlIndex = KeyData->Key.UnicodeChar;
|
||||||
} else if (((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) &&
|
} else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
|
((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) {
|
((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) {
|
||||||
//
|
//
|
||||||
// For those console devices that can report the CONTROL state,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure only CONTROL is pressed.
|
// make sure only CONTROL is pressed.
|
||||||
//
|
//
|
||||||
if ((KeyData->Key.UnicodeChar >= L'A') && (KeyData->Key.UnicodeChar <= L'Z')) {
|
if ((KeyData->Key.UnicodeChar >= L'A') && (KeyData->Key.UnicodeChar <= L'Z')) {
|
||||||
|
@ -134,18 +134,20 @@ HMainCommandDisplayHelp (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) {
|
if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) ||
|
||||||
|
(KeyData.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) {
|
||||||
//
|
//
|
||||||
// For consoles that don't support shift state reporting,
|
// For consoles that don't support/report shift state,
|
||||||
// CTRL+W is translated to L'W' - L'A' + 1.
|
// CTRL+W is translated to L'W' - L'A' + 1.
|
||||||
//
|
//
|
||||||
if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) {
|
if (KeyData.Key.UnicodeChar == L'W' - L'A' + 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
} else if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&
|
||||||
|
((KeyData.KeyState.KeyShiftState & (EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) != 0) &&
|
||||||
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
((KeyData.KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_LEFT_CONTROL_PRESSED | EFI_RIGHT_CONTROL_PRESSED)) == 0)) {
|
||||||
//
|
//
|
||||||
// For consoles that supports shift state reporting,
|
// For consoles that supports/reports shift state,
|
||||||
// make sure that only CONTROL shift key is pressed.
|
// make sure that only CONTROL shift key is pressed.
|
||||||
//
|
//
|
||||||
if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) {
|
if ((KeyData.Key.UnicodeChar == 'w') || (KeyData.Key.UnicodeChar == 'W')) {
|
||||||
|
Reference in New Issue
Block a user