The original code does not initialize the global width constants before creating menu options. That caused an issue when long strings are used in the first HII form, but only when displayed for the first time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud elhaj@hp.com 
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15898 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Samer El-Haj-Mahmoud elhaj 2014-08-26 07:16:29 +00:00 committed by ydong10
parent fae62ff21a
commit c4866c7710
1 changed files with 17 additions and 12 deletions

View File

@ -2,6 +2,7 @@
Entry and initialization module for the browser.
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -2125,16 +2126,7 @@ UiDisplayMenu (
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
//
// Left right
// |<-.->|<-.........->|<- .........->|<-...........->|
// Skip Prompt Option Help
//
Width = (CHAR16) ((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3);
gOptionBlockWidth = Width + 1;
gHelpBlockWidth = (CHAR16) (Width - LEFT_SKIPPED_COLUMNS);
gPromptBlockWidth = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * Width - 1);
Width = (UINT16)gOptionBlockWidth - 1;
TopRow = gStatementDimensions.TopRow + SCROLL_ARROW_HEIGHT;
BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT - 1;
@ -3417,13 +3409,26 @@ FormDisplay (
return EFI_SUCCESS;
}
ConvertStatementToMenu();
Status = DisplayPageFrame (FormData, &gStatementDimensions);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Global Widths should be initialized before any MenuOption creation
// or the GetWidth() used in UiAddMenuOption() will return incorrect value.
//
//
// Left right
// |<-.->|<-.........->|<- .........->|<-...........->|
// Skip Prompt Option Help
//
gOptionBlockWidth = (CHAR16) ((gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn) / 3) + 1;
gHelpBlockWidth = (CHAR16) (gOptionBlockWidth - 1 - LEFT_SKIPPED_COLUMNS);
gPromptBlockWidth = (CHAR16) (gStatementDimensions.RightColumn - gStatementDimensions.LeftColumn - 2 * (gOptionBlockWidth - 1) - 1);
ConvertStatementToMenu();
//
// Check whether layout is changed.
//