summaryrefslogtreecommitdiff
path: root/osdbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdbase.c')
-rw-r--r--osdbase.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/osdbase.c b/osdbase.c
index ac8026ff..dea1d995 100644
--- a/osdbase.c
+++ b/osdbase.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osdbase.c 4.2 2017/04/03 12:30:52 kls Exp $
+ * $Id: osdbase.c 4.3 2017/11/07 15:42:47 kls Exp $
*/
#include "osdbase.h"
@@ -92,6 +92,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
SetTitle(Title);
SetCols(c0, c1, c2, c3, c4);
first = 0;
+ lastOffset = 0;
current = marked = -1;
subMenu = NULL;
helpRed = helpGreen = helpYellow = helpBlue = NULL;
@@ -253,7 +254,7 @@ void cOsdMenu::Display(void)
}
if (current < 0)
current = 0; // just for safety - there HAS to be a current item!
- first = min(first, max(0, count - displayMenuItems)); // in case the menu size has changed
+ first = max(0, min(first, max(0, count - displayMenuItems))); // in case the menu size has changed
if (current - first >= displayMenuItems || current < first) {
first = current - displayMenuItems / 2;
if (first + displayMenuItems > count)
@@ -281,6 +282,9 @@ void cOsdMenu::Display(void)
void cOsdMenu::SetCurrent(cOsdItem *Item)
{
current = Item ? Item->Index() : -1;
+ if (current >= 0 && lastOffset > 0)
+ first = max(0, current - lastOffset);
+ lastOffset = 0;
}
void cOsdMenu::RefreshCurrent(void)
@@ -326,6 +330,7 @@ void cOsdMenu::Clear(void)
{
if (marked >= 0)
SetStatus(NULL);
+ lastOffset = (current > first) ? current - first : 0;
first = 0;
current = marked = -1;
cList<cOsdItem>::Clear();