Snap for 11017726 from 7b5068bb5ebd036d669f69891adc7c409b71c5f6 to 24Q1-release

Change-Id: Iffcc183165a60c1351af3c68f900944e234968b7
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index ee3cbb1..37e0764 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -181,7 +181,15 @@
   if (!scrollable()) {
     offset += draw_funcs_.DrawHorizontalRule(y + offset) + 4;
   }
-  for (size_t i = MenuStart(); i < MenuEnd(); ++i) {
+
+  int items_block_height = gr_fb_height() - y - offset;;
+  int total = (char_height_ + 4) * (selection() + 1);;
+  int j = 0;
+  if (total > items_block_height) {
+    j = ((total - items_block_height) / (char_height_ + 4)) + 1;
+  }
+
+  for (size_t i = (MenuStart() + j); i < MenuEnd(); ++i) {
     bool bold = false;
     if (i == selection()) {
       // Draw the highlight bar.