MdeModulePkg/DisplayEngine: Return the selectable menu correctly

When returning selectable menu, should return the menu in current form,
the codes miss to do the check. Now returning the selectable menu behind
the codes "if ((UINTN) Distance + NextMenuOption->Skip > GapToTop)".
Then can cover the check, can return the menu correctly.

https://bugzilla.tianocore.org/show_bug.cgi?id=232

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index c2cffec..316e2e3 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -1050,12 +1050,8 @@
       UpdateOptionSkipLines (NextMenuOption);

     }

 

-    if (IsSelectable (NextMenuOption)) {

-      break;

-    }

-

     //

-    // In this case, still can't find the selectable menu,

+    // Check whether the menu is beyond current showing form,

     // return the first one beyond the showing form.

     //

     if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {

@@ -1065,6 +1061,13 @@
       break;

     }

 

+    //

+    // return the selectable menu in the showing form.

+    //

+    if (IsSelectable (NextMenuOption)) {

+      break;

+    }

+

     Distance += NextMenuOption->Skip;

 

     //