[edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance the arrow keys support

Liming Gao liming.gao at intel.com
Wed Sep 25 13:32:29 UTC 2019


Thanks for your quick fix. 

> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Gao, Zhichao
> Sent: Wednesday, September 25, 2019 8:09 PM
> To: devel at edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang at intel.com>; Wu, Hao A <hao.a.wu at intel.com>; Ni, Ray <ray.ni at intel.com>; Gao, Liming
> <liming.gao at intel.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/TerminalDxe: Enhance the arrow keys support
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2219
> 
> Refer to
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-appcursor
> In normal mode, arrow key would send ESC [A through to ESC [D.
> In application mode, arrow key would send ESC OA through to
> ESC OD.
> 
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Signed-off-by: Zhichao Gao <zhichao.gao at intel.com>
> ---
>  .../Console/TerminalDxe/TerminalConIn.c       | 46 ++++++++++++++++---
>  1 file changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> index ac31f27984..fdb1a0f1ef 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
> @@ -1402,10 +1402,7 @@ UnicodeToEfiKey (
>          continue;
>        }
> 
> -      if (UnicodeChar == 'O' && (TerminalDevice->TerminalType == TerminalTypeVt100 ||
> -                                 TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
> -                                 TerminalDevice->TerminalType == TerminalTypeXtermR6 ||
> -                                 TerminalDevice->TerminalType == TerminalTypeVt100Plus)) {
> +      if (UnicodeChar == 'O') {
>          TerminalDevice->InputState |= INPUT_STATE_O;
>          TerminalDevice->ResetState = RESET_STATE_DEFAULT;
>          continue;
> @@ -1631,6 +1628,35 @@ UnicodeToEfiKey (
>          }
>        }
> 
> +      //
> +      // In Putty application mode, the arrow keys would send
> +      // ESC OA through to ESC OD
> +      //
> +      if (TerminalDevice->TerminalType == TerminalTypePcAnsi    ||
> +          TerminalDevice->TerminalType == TerminalTypeVt100     ||
> +          TerminalDevice->TerminalType == TerminalTypeVt100Plus ||
> +          TerminalDevice->TerminalType == TerminalTypeVtUtf8    ||
> +          TerminalDevice->TerminalType == TerminalTypeTtyTerm   ||
> +          TerminalDevice->TerminalType == TerminalTypeLinux     ||
> +          TerminalDevice->TerminalType == TerminalTypeXtermR6   ||
> +          TerminalDevice->TerminalType == TerminalTypeVt400     ||
> +          TerminalDevice->TerminalType == TerminalTypeSCO) {
> +        switch (UnicodeChar) {
> +        case 'A':
> +          Key.ScanCode = SCAN_UP;
> +          break;
> +        case 'B':
> +          Key.ScanCode = SCAN_DOWN;
> +          break;
> +        case 'C':
> +          Key.ScanCode = SCAN_RIGHT;
> +          break;
> +        case 'D':
> +          Key.ScanCode = SCAN_LEFT;
> +          break;
> +        }
> +      }
> +
>        if (Key.ScanCode != SCAN_NULL) {
>          Key.UnicodeChar = 0;
>          EfiKeyFiFoInsertOneKey (TerminalDevice, &Key);
> @@ -1668,10 +1694,18 @@ UnicodeToEfiKey (
> 
>        Key.ScanCode = SCAN_NULL;
> 
> +      //
> +      // In Putty normal mode, the arrow keys would send
> +      // ESC [A through to [D
> +      //
>        if (TerminalDevice->TerminalType == TerminalTypePcAnsi    ||
>            TerminalDevice->TerminalType == TerminalTypeVt100     ||
> -          TerminalDevice->TerminalType == TerminalTypeVtUtf8 ||
> -          TerminalDevice->TerminalType == TerminalTypeTtyTerm ||
> +          TerminalDevice->TerminalType == TerminalTypeVt100Plus ||
> +          TerminalDevice->TerminalType == TerminalTypeVtUtf8    ||
> +          TerminalDevice->TerminalType == TerminalTypeTtyTerm   ||
> +          TerminalDevice->TerminalType == TerminalTypeLinux     ||
> +          TerminalDevice->TerminalType == TerminalTypeXtermR6   ||
> +          TerminalDevice->TerminalType == TerminalTypeVt400     ||
>            TerminalDevice->TerminalType == TerminalTypeSCO) {
>          switch (UnicodeChar) {
>          case 'A':
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48034): https://edk2.groups.io/g/devel/message/48034
Mute This Topic: https://groups.io/mt/34286845/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list