Don't lose the cursor when scrolling up in option menus

- Fixed: If the menu cursor was on the topmost-displayed item, pressing up
  would not scroll the view up. The check for scrolling only tested if the
  newly selected item was the topmost one, since the menu code had
  assumed the only time the cursor would be on the topmost visible line
  was when it was the very first line of the menu. Using PgDn breaks this
  assumption.
This commit is contained in:
Randy Heit 2015-01-31 20:10:18 -06:00
parent b69edbbec1
commit dc6b45804d

View file

@ -196,9 +196,9 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller)
--mDesc->mSelectedItem; --mDesc->mSelectedItem;
if (mDesc->mScrollPos > 0 && if (mDesc->mScrollPos > 0 &&
mDesc->mSelectedItem == mDesc->mScrollTop + mDesc->mScrollPos) mDesc->mSelectedItem <= mDesc->mScrollTop + mDesc->mScrollPos)
{ {
mDesc->mScrollPos--; mDesc->mScrollPos = MAX(mDesc->mSelectedItem - mDesc->mScrollTop - 1, 0);
} }
if (mDesc->mSelectedItem < 0) if (mDesc->mSelectedItem < 0)