simplify NCurses::Menu::Goto()

This commit is contained in:
Andrzej Rybczak
2009-09-16 19:56:32 +00:00
parent d73230cdb2
commit 436dbddc81

View File

@@ -712,12 +712,7 @@ template <typename T> bool NCurses::Menu<T>::Goto(size_t y)
{
if (!itsOptionsPtr->at(itsBeginning+y) || itsOptionsPtr->at(itsBeginning+y)->isStatic)
return false;
size_t cur_pos = itsHighlight-itsBeginning;
while (itsHighlight-itsBeginning != int(y) && (y < cur_pos || size_t(itsHighlight) < itsOptions.size()-1))
{
Scroll(y < cur_pos ? wUp : wDown);
y < cur_pos ? cur_pos-- : cur_pos++;
}
itsHighlight = itsBeginning+y;
return true;
}