public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg: print only valid characters for file overwrite prompt
@ 2016-10-28 19:48 Tapan Shah
  2016-10-31 15:22 ` Carsey, Jaben
  0 siblings, 1 reply; 2+ messages in thread
From: Tapan Shah @ 2016-10-28 19:48 UTC (permalink / raw)
  To: edk2-devel; +Cc: jaben.carsey, Tapan Shah

When copy command prompts to overwrite an existing file, pressing
backspace continuously removes everything including the shell prompt.
So print only valid characters for file overwrite prompt.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
---
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 2389207..536db3c 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -3403,7 +3403,8 @@ ShellPromptForResponse (
             break;
         }
       }
-      break;    case ShellPromptResponseTypeYesNoAllCancel:
+      break;
+      case ShellPromptResponseTypeYesNoAllCancel:
        if (Prompt != NULL) {
         ShellPrintEx(-1, -1, L"%s", Prompt);
       }
@@ -3421,7 +3422,11 @@ ShellPromptForResponse (
         if (EFI_ERROR(Status)) {
           break;
         }
-        ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
+
+        if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) {
+          ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
+        }
+
         switch (Key.UnicodeChar) {
           case L'Y':
           case L'y':
-- 
1.9.5.msysgit.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ShellPkg: print only valid characters for file overwrite prompt
  2016-10-28 19:48 [PATCH] ShellPkg: print only valid characters for file overwrite prompt Tapan Shah
@ 2016-10-31 15:22 ` Carsey, Jaben
  0 siblings, 0 replies; 2+ messages in thread
From: Carsey, Jaben @ 2016-10-31 15:22 UTC (permalink / raw)
  To: Tapan Shah, edk2-devel@lists.01.org; +Cc: Carsey, Jaben

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
And pushed.

> -----Original Message-----
> From: Tapan Shah [mailto:tapandshah@hpe.com]
> Sent: Friday, October 28, 2016 12:49 PM
> To: edk2-devel@lists.01.org
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Tapan Shah
> <tapandshah@hpe.com>
> Subject: [PATCH] ShellPkg: print only valid characters for file overwrite
> prompt
> Importance: High
> 
> When copy command prompts to overwrite an existing file, pressing
> backspace continuously removes everything including the shell prompt.
> So print only valid characters for file overwrite prompt.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Tapan Shah <tapandshah@hpe.com>
> ---
>  ShellPkg/Library/UefiShellLib/UefiShellLib.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 2389207..536db3c 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -3403,7 +3403,8 @@ ShellPromptForResponse (
>              break;
>          }
>        }
> -      break;    case ShellPromptResponseTypeYesNoAllCancel:
> +      break;
> +      case ShellPromptResponseTypeYesNoAllCancel:
>         if (Prompt != NULL) {
>          ShellPrintEx(-1, -1, L"%s", Prompt);
>        }
> @@ -3421,7 +3422,11 @@ ShellPromptForResponse (
>          if (EFI_ERROR(Status)) {
>            break;
>          }
> -        ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar);
> +
> +        if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) {
> +          ShellPrintEx (-1, -1, L"%c", Key.UnicodeChar);
> +        }
> +
>          switch (Key.UnicodeChar) {
>            case L'Y':
>            case L'y':
> --
> 1.9.5.msysgit.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-31 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-28 19:48 [PATCH] ShellPkg: print only valid characters for file overwrite prompt Tapan Shah
2016-10-31 15:22 ` Carsey, Jaben

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox