From dc6b45804d22ea84d2f7a506c4bc2ac79d87a9be Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 31 Jan 2015 20:10:18 -0600 Subject: [PATCH] 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. --- src/menu/optionmenu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu/optionmenu.cpp b/src/menu/optionmenu.cpp index eff53fc49..9a7715265 100644 --- a/src/menu/optionmenu.cpp +++ b/src/menu/optionmenu.cpp @@ -196,9 +196,9 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller) --mDesc->mSelectedItem; 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)