From 487ef018038fa782571bfa5f07a9362e86d1c17b Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 10 Mar 2011 02:28:15 +0000 Subject: 1. The old refresh string code also update the time/date opcode. But for the reason that time/date opcode updates the string with the same size, so skip the refresh code for it. 2. Also, the clean old string action used save attribute with paint string action which makes the background show abnormal. Now using the normal attribute to clean the old string. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11359 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 05fcb7cc5d..3ab63be2d6 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -342,7 +342,6 @@ RefreshForm ( FORM_BROWSER_STATEMENT *Question; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; EFI_BROWSER_ACTION_REQUEST ActionRequest; - CHAR16 *PadString; if (gMenuRefreshHead != NULL) { @@ -354,8 +353,6 @@ RefreshForm ( mHiiPackageListUpdated = FALSE; do { - gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute); - Selection = MenuRefreshEntry->Selection; Question = MenuRefreshEntry->MenuOption->ThisTag; @@ -374,11 +371,22 @@ RefreshForm ( for (Index = 0; OptionString[Index] == L' '; Index++) ; - PadString = AllocatePool (gOptionBlockWidth * sizeof (CHAR16)); - SetMem16 (PadString, (gOptionBlockWidth - 1) * sizeof (CHAR16), CHAR_SPACE); - PadString[gOptionBlockWidth - 1] = 0; - PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, PadString); - FreePool (PadString); + // + // If old Text is longer than new string, need to clean the old string before paint the newer. + // This option is no need for time/date opcode, because time/data opcode has fixed string length. + // + if ((MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_DATE_OP) && + (MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_TIME_OP)) { + ClearLines ( + MenuRefreshEntry->CurrentColumn, + MenuRefreshEntry->CurrentColumn + gOptionBlockWidth - 1, + MenuRefreshEntry->CurrentRow, + MenuRefreshEntry->CurrentRow, + PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND + ); + } + + gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute); PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]); FreePool (OptionString); } -- cgit v1.2.3