Main file for Type shell level 3 function.\r
\r
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved. <BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
// Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)\r
// characters to be displayed as is.\r
//\r
- if (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r') {\r
+ if ((AsciiChar == '\n' && LoopVar == 0) ||\r
+ (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r')) {\r
//\r
- // In case Line Feed (0xA) is encountered & Carriage Return (0xD)\r
- // was not the previous character, print CR and LF. This is because\r
- // Shell 2.0 requires carriage return with line feed for displaying\r
- // each new line from left.\r
+ // In case file begin with single line Feed or Line Feed (0xA) is\r
+ // encountered & Carriage Return (0xD) was not previous character,\r
+ // print CR and LF. This is because Shell 2.0 requires carriage\r
+ // return with line feed for displaying each new line from left.\r
//\r
ShellPrintEx (-1, -1, L"\r\n");\r
continue;\r
// Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD)\r
// characters to be displayed as is.\r
//\r
- if (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r') {\r
+ if ((Ucs2Char == '\n' && LoopVar == 0) ||\r
+ (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r')) {\r
//\r
- // In case Line Feed (0xA) is encountered & Carriage Return (0xD)\r
- // was not the previous character, print CR and LF. This is because\r
- // Shell 2.0 requires carriage return with line feed for displaying\r
- // each new line from left.\r
+ // In case file begin with single line Feed or Line Feed (0xA) is\r
+ // encountered & Carriage Return (0xD) was not previous character,\r
+ // print CR and LF. This is because Shell 2.0 requires carriage\r
+ // return with line feed for displaying each new line from left.\r
//\r
ShellPrintEx (-1, -1, L"\r\n");\r
continue;\r