]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
DisplayEngineDxe: Fixed calculate help string page count error.
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / FormDisplay.c
index ae3038b6cb57089656e1669308814371fb8bcec3..a391442d169ac02e3d175b7046aeb38574cb2efc 100644 (file)
@@ -1782,14 +1782,15 @@ FindTopMenu (
 \r
   TopRow    = gStatementDimensions.TopRow    + SCROLL_ARROW_HEIGHT;\r
   BottomRow = gStatementDimensions.BottomRow - SCROLL_ARROW_HEIGHT;\r
-\r
-  if (gMisMatch) {\r
+  //\r
+  // When option mismatch happens,there exist two cases,one is reenter the form, just like the if case below,\r
+  // and the other is exit current form and enter last form, it can be covered by the else case.\r
+  //\r
+  if (gMisMatch && gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle && gFormData->FormId == gHighligthMenuInfo.FormId) {\r
     //\r
     // Reenter caused by option mismatch or auto exit caused by refresh form(refresh interval/guid), \r
     // base on the record highlight info to find the highlight menu.\r
     //\r
-    ASSERT (gFormData->HiiHandle == gHighligthMenuInfo.HiiHandle &&\r
-            gFormData->FormId == gHighligthMenuInfo.FormId);\r
 \r
     *HighlightMenu = FindHighLightMenuOption(NULL);\r
     if (*HighlightMenu != NULL) {\r
@@ -1840,7 +1841,6 @@ FindTopMenu (
       *SkipValue = 0;\r
     }\r
 \r
-    gMisMatch = FALSE;\r
   } else if (FormData->HighLightedStatement != NULL) {\r
     if (IsSavedHighlightStatement (FormData->HighLightedStatement)) {\r
       //\r
@@ -1914,6 +1914,8 @@ FindTopMenu (
     *SkipValue     = 0;\r
   }\r
 \r
+  gMisMatch = FALSE;\r
+\r
   //\r
   // First enter to show the menu, update highlight info.\r
   //\r
@@ -2259,7 +2261,8 @@ FxConfirmPopup (
   do {\r
     CreateDialog (&Key, gEmptyString, CfmStr, gConfirmOpt, gEmptyString, NULL);\r
   } while (((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (gConfirmOptYes[0] | UPPER_LOWER_CASE_OFFSET)) &&\r
-           ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (gConfirmOptNo[0] | UPPER_LOWER_CASE_OFFSET)));\r
+           ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (gConfirmOptNo[0] | UPPER_LOWER_CASE_OFFSET)) &&\r
+           (Key.ScanCode != SCAN_ESC));\r
 \r
   if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (gConfirmOptYes[0] | UPPER_LOWER_CASE_OFFSET)) {\r
     RetVal = TRUE;\r
@@ -2946,7 +2949,7 @@ UiDisplayMenu (
           //\r
           if (HelpLine > 2 * RowCount - 2) {\r
             HelpPageCount = (HelpLine - RowCount + 1) / (RowCount - 2) + 1;\r
-            if ((HelpLine - RowCount + 1) % (RowCount - 2) > 1) {\r
+            if ((HelpLine - RowCount + 1) % (RowCount - 2) != 0) {\r
               HelpPageCount += 1;\r
             }\r
           } else {\r