From c4866c7710c250b83018de6a1fcde6433f87ff3e Mon Sep 17 00:00:00 2001 From: Samer El-Haj-Mahmoud elhaj Date: Tue, 26 Aug 2014 07:16:29 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15898 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DisplayEngineDxe/FormDisplay.c | 29 +++++++++++-------- 1 file 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.
+Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
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. // -- 2.39.2