Remove lots of useless stupid, and code greedy options.
[apps/madmutt.git] / lib-ui / menu.c
index f8a2565..928834c 100644 (file)
@@ -117,7 +117,7 @@ void menu_redraw_full (MUTTMENU * menu)
   wclrtobot (main_w);
 
   SETCOLOR(main_w, MT_COLOR_STATUS);
-  wmove (main_w, option (OPTSTATUSONTOP) ? LINES - 2 : 0, 0);
+  wmove (main_w, LINES - 2, 0);
   mutt_paddstr (main_w, getmaxx(main_w), "");
   SETCOLOR(main_w, MT_COLOR_NORMAL);
   menu->offset = 1;
@@ -133,7 +133,7 @@ void menu_redraw_status (MUTTMENU * menu)
 
   snprintf (buf, sizeof (buf), M_MODEFMT, menu->title);
   SETCOLOR(main_w, MT_COLOR_STATUS);
-  wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+  wmove (main_w, 0, 0);
   mutt_paddstr (main_w, getmaxx(main_w), buf);
   SETCOLOR(main_w, MT_COLOR_NORMAL);
   menu->redraw &= ~REDRAW_STATUS;
@@ -251,27 +251,18 @@ void menu_check_recenter (MUTTMENU * menu)
   int c = MIN (MenuContext, menu->pagelen / 2);
   int old_top = menu->top;
 
-  if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) { /* less entries than lines */
-    if (menu->top != 0) {
-      menu->top = 0;
-      set_option (OPTNEEDREDRAW);
-    }
+  if ((menu->pagelen <= 0) || (c < MenuContext)) {
+    if (menu->current < menu->top + c)
+      menu->top = menu->current - c;
+    else if (menu->current >= menu->top + menu->pagelen - c)
+      menu->top = menu->current - menu->pagelen + c + 1;
   } else {
-    if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext)) {
-      if (menu->current < menu->top + c)
-        menu->top = menu->current - c;
-      else if (menu->current >= menu->top + menu->pagelen - c)
-        menu->top = menu->current - menu->pagelen + c + 1;
-    } else {
-      if (menu->current < menu->top + c)
-        menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c;
-      else if ((menu->current >= menu->top + menu->pagelen - c))
-        menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
-    }
+    if (menu->current < menu->top + c)
+      menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c;
+    else if ((menu->current >= menu->top + menu->pagelen - c))
+      menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
   }
 
-  if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */
-    menu->top = MIN (menu->top, menu->max - menu->pagelen);
   menu->top = MAX (menu->top, 0);
 
   if (menu->top != old_top)
@@ -305,20 +296,17 @@ void menu_next_line (MUTTMENU * menu)
   if (menu->max) {
     int c = MIN (MenuContext, menu->pagelen / 2);
 
-    if (menu->top + 1 < menu->max - c && (option (OPTMENUMOVEOFF)
-                                          || (menu->max > menu->pagelen
-                                              && menu->top <
-                                              menu->max - menu->pagelen))) {
+    if (menu->top + 1 < menu->max - c) {
       menu->top++;
       if (menu->current < menu->top + c && menu->current < menu->max - 1)
         menu->current++;
       menu->redraw = REDRAW_INDEX;
-    }
-    else
+    } else {
       mutt_error _("You cannot scroll down farther.");
-  }
-  else
+    }
+  } else {
     mutt_error _("No entries.");
+  }
 }
 
 void menu_prev_line (MUTTMENU * menu)
@@ -353,7 +341,7 @@ static void menu_length_jump (MUTTMENU *menu, int jumplen) {
       menu->top += jumplen;
 
       /* jumped too long? */
-      if ((neg || !option (OPTMENUMOVEOFF)) && DIRECTION * menu->top > tmp)
+      if (neg && DIRECTION * menu->top > tmp)
         menu->top = tmp;
 
       /* need to move the cursor? */