diff options
author | Samer El-Haj-Mahmoud elhaj <Samer El-Haj-Mahmoud elhaj@hp.com> | 2014-08-26 07:16:29 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-26 07:16:29 +0000 |
commit | c4866c7710c250b83018de6a1fcde6433f87ff3e (patch) | |
tree | 8d199e23e264d73cfd623562244039b09383c983 | |
parent | fae62ff21a2127df1cf2672aecd1faad95b4a6e7 (diff) | |
download | edk2-platforms-c4866c7710c250b83018de6a1fcde6433f87ff3e.tar.xz |
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
-rw-r--r-- | MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c index 6d0dd2569c..0db450e078 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -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,14 +3409,27 @@ 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.
//
if (mIsFirstForm
|