Skip to content

Commit

Permalink
Add Libraries, Components, and UnitTests, and BugFixes to ShellPkg.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Carlson authored and kenlautner committed May 4, 2023
1 parent 92fde1c commit ce99f24
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
33 changes: 24 additions & 9 deletions ShellPkg/Application/Shell/ConsoleLogger.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,27 @@ ConsoleLoggerPrintWithPageBreak (
CONST CHAR16 *LineStart;
CHAR16 *StringCopy;
CHAR16 TempChar;
INT32 curCol; // MS_CHANGE

StringCopy = NULL;
StringCopy = StrnCatGrow (&StringCopy, NULL, String, 0);
if (StringCopy == NULL) {
return (EFI_OUT_OF_RESOURCES);
}

// MS_CHANGE: Start
//
// Go through the string and output one line at a time
// After each line a check will be made
//
// To track line breaks caused by string wrapping this needs to
// duplicate some of the string printing logic in the graphics
// console tracking the current column. When a line wrap is
// detected, stop printing and see if a page break is needed.
//
curCol = ConsoleInfo->OurConOut.Mode->CursorColumn;
// MS_CHANGE

for ( Walker = StringCopy,
LineStart = StringCopy
; Walker != NULL && *Walker != CHAR_NULL
Expand All @@ -734,9 +748,10 @@ ConsoleLoggerPrintWithPageBreak (
{
switch (*Walker) {
case (CHAR_BACKSPACE):
if (ConsoleInfo->OurConOut.Mode->CursorColumn > 0) {
ConsoleInfo->OurConOut.Mode->CursorColumn--;
}
if (curCol > 0) {
// MS_CHANGE
curCol--; // MS_CHANGE
} // MS_CHANGE

break;
case (CHAR_LINEFEED):
Expand Down Expand Up @@ -765,24 +780,25 @@ ConsoleLoggerPrintWithPageBreak (
// increment row count
//
ShellInfoObject.ConsoleInfo->RowCounter++;
ConsoleInfo->OurConOut.Mode->CursorRow++;
// ConsoleInfo->OurConOut.Mode->CursorRow++; // MS_CHANGE

break;
case (CHAR_CARRIAGE_RETURN):
//
// Move the cursor to the beginning of the current row.
//
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
curCol = 0; // MS_CHANGE
break;
default:
//
// increment column count
//
ConsoleInfo->OurConOut.Mode->CursorColumn++;
curCol++; // MS_CHANGE
//
// check if that is the last column
//
if ((INTN)ConsoleInfo->ColsPerScreen == ConsoleInfo->OurConOut.Mode->CursorColumn + 1) {
if ((INTN)ConsoleInfo->ColsPerScreen == curCol + 1) {
// MS_CHANGE
//
// output a line similar to the linefeed character.
//
Expand Down Expand Up @@ -812,8 +828,7 @@ ConsoleLoggerPrintWithPageBreak (
// increment row count and zero the column
//
ShellInfoObject.ConsoleInfo->RowCounter++;
ConsoleInfo->OurConOut.Mode->CursorRow++;
ConsoleInfo->OurConOut.Mode->CursorColumn = 0;
curCol = 0; // MS_CHANGE
} // last column on line

break;
Expand Down
22 changes: 22 additions & 0 deletions ShellPkg/ShellPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,29 @@
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf

UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf # MU_CHANGE
MemoryTypeInformationChangeLib|MdeModulePkg/Library/MemoryTypeInformationChangeLibNull/MemoryTypeInformationChangeLibNull.inf # MU_CHANGE
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf

## MU_CHANGE Begin
[LibraryClasses.common]
BaseBinSecurityLib|MdePkg/Library/BaseBinSecurityLibNull/BaseBinSecurityLibNull.inf
!if $(TOOL_CHAIN_TAG) == VS2017 or $(TOOL_CHAIN_TAG) == VS2015 or $(TOOL_CHAIN_TAG) == VS2019
!if $(TARGET) == DEBUG
[LibraryClasses.X64, LibraryClasses.IA32]
#if debug is enabled provide StackCookie support lib so that we can link to /GS exports on MSVC
RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
[LibraryClasses.X64]
BaseBinSecurityLib|MdePkg/Library/BaseBinSecurityLibRng/BaseBinSecurityLibRng.inf
NULL|MdePkg/Library/BaseBinSecurityLibRng/BaseBinSecurityLibRng.inf
!endif
!endif
## MU_CHANGE End

[LibraryClasses.ARM,LibraryClasses.AARCH64]
#
# It is not possible to prevent the ARM compiler for generic intrinsic functions.
Expand All @@ -89,6 +106,11 @@
# Build all the libraries when building this package.
# This helps developers test changes and how they affect the package.
#
## MU_CHANGE BEGIN
ShellPkg/Application/ShellCTestApp/ShellCTestApp.inf
ShellPkg/Application/ShellExecTestApp/SA.inf
ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.inf
## MU_CHANGE END
ShellPkg/Library/UefiShellLib/UefiShellLib.inf
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
Expand Down

0 comments on commit ce99f24

Please sign in to comment.