.../CustomizedDisplayLibInternal.c | 21 ++++++++------------- .../Universal/DisplayEngineDxe/FormDisplay.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 21 deletions(-)
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../CustomizedDisplayLibInternal.c | 21 ++++++++-------------
.../Universal/DisplayEngineDxe/FormDisplay.c | 15 +++++++--------
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
index bc14a9d..3e24f35 100644
--- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
+++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInternal.c
@@ -857,12 +857,10 @@ PrintInternal (
CHAR16 *BackupBuffer;
UINTN Index;
UINTN PreviousIndex;
UINTN Count;
UINTN TotalCount;
- UINTN PrintWidth;
- UINTN CharWidth;
//
// For now, allocate an arbitrarily long buffer
//
Buffer = AllocateZeroPool (0x10000);
@@ -882,12 +880,18 @@ PrintInternal (
Index = 0;
PreviousIndex = 0;
Count = 0;
TotalCount = 0;
- PrintWidth = 0;
- CharWidth = 1;
+
+ //
+ // Clean the line and then reset the position of the cursor.
+ //
+ Out->OutputString (Out, &mSpaceBuffer[SPACE_BUFFER_SIZE - Width]);
+ if (Column != (UINTN) -1) {
+ Out->SetCursorPosition (Out, Column, Row);
+ }
do {
for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
BackupBuffer[Index] = Buffer[Index];
}
@@ -899,11 +903,10 @@ PrintInternal (
//
// Print this out, we are about to switch widths
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count = StrLen (&BackupBuffer[PreviousIndex]);
- PrintWidth += Count * CharWidth;
TotalCount += Count;
//
// Preserve the current index + 1, since this is where we will start printing from next
//
@@ -916,18 +919,16 @@ PrintInternal (
//
// Preserve bits 0 - 6 and zero out the rest
//
Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
Out->SetAttribute (Out, Out->Mode->Attribute);
- CharWidth = 1;
} else {
//
// Must be wide, set bit 7 ON
//
Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
Out->SetAttribute (Out, Out->Mode->Attribute);
- CharWidth = 2;
}
Index++;
} while (Buffer[Index] != 0);
@@ -935,17 +936,11 @@ PrintInternal (
//
// We hit the end of the string - print it
//
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count = StrLen (&BackupBuffer[PreviousIndex]);
- PrintWidth += Count * CharWidth;
TotalCount += Count;
- if (PrintWidth < Width) {
- Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
- Out->SetAttribute (Out, Out->Mode->Attribute);
- Out->OutputString (Out, &mSpaceBuffer[SPACE_BUFFER_SIZE - Width + PrintWidth]);
- }
FreePool (Buffer);
FreePool (BackupBuffer);
return TotalCount;
}
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index e1ac5a3..2938351 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -2056,32 +2056,31 @@ DisplayMenuString (
IN CHAR16 *String,
IN UINTN Width,
IN BOOLEAN Highlight
)
{
- UINTN Length;
-
//
// Print string with normal color.
//
if (!Highlight) {
PrintStringAtWithWidth (Col, Row, String, Width);
return;
}
-
//
// Print the highlight menu string.
- // First print the highlight string.
+ // First, clean the line.
//
+ PrintStringAtWithWidth (Col, Row, L"", Width);
+ //
+ // Second, set the display attribute for highlight string and then print it.
+ //
SetDisplayAttribute(MenuOption, TRUE);
- Length = PrintStringAt (Col, Row, String);
-
+ PrintStringAt (Col, Row, String);
//
- // Second, clean the empty after the string.
+ // Last, reset the display attribute.
//
SetDisplayAttribute(MenuOption, FALSE);
- PrintStringAtWithWidth (Col + Length, Row, L"", Width - Length);
}
/**
Check whether this menu can has option string.
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.