fix pagedown logic, but this time for real (i hope)

Why this was so difficult code? I don't know.


Origin commit data
------------------
Branch: ni/coolstream
Commit: b00e78a165
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-01-15 (Fri, 15 Jan 2016)

Origin message was:
------------------
- fix pagedown logic, but this time for real (i hope)

 Why this was so difficult code? I don't know.


------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-01-15 13:51:14 +01:00
parent 41b4bdde79
commit 82c03e117f
6 changed files with 21 additions and 33 deletions

View File

@@ -208,13 +208,11 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
if(getItemCount()!=0) {
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
int new_selected = selected + step;
if (new_selected >= (int) getItemCount()) {
if (((getItemCount() - listmaxshow -1 < selected) && (step != 1)) || (selected != (getItemCount() - 1)))
if (new_selected > (int) getItemCount() - 1) {
if ((selected != getItemCount() - 1))
new_selected = getItemCount() - 1;
else if (((getItemCount() / listmaxshow) + 1) * listmaxshow == getItemCount() + listmaxshow) // last page has full entries
new_selected = 0;
else
new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((getItemCount() / listmaxshow)+1) * listmaxshow))) ? (getItemCount() - 1) : 0;
new_selected = 0;
}
updateSelection(new_selected);
}