check if highlighted position is visible

This commit is contained in:
Andrzej Rybczak
2008-12-12 22:38:08 +01:00
parent 65e5006a6e
commit aac3ce17ee

View File

@@ -265,6 +265,8 @@ template <class T> void Menu<T>::Refresh()
return; return;
} }
int MaxBeginning = itsOptions.size() < itsHeight ? 0 : itsOptions.size()-itsHeight; int MaxBeginning = itsOptions.size() < itsHeight ? 0 : itsOptions.size()-itsHeight;
if (itsHighlight > itsBeginning+itsHeight-1)
itsBeginning = itsHighlight-itsHeight+1;
if (itsBeginning < 0) if (itsBeginning < 0)
itsBeginning = 0; itsBeginning = 0;
else if (itsBeginning > MaxBeginning) else if (itsBeginning > MaxBeginning)