X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4e0d819f0c1b9d7443e1699ec0567c54cdeb55f3..455b3c03c4764b51ace06499aebbe01618469142:/lib/gui/elistbox.cpp diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 7af7dabb..09d5ec2a 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -157,6 +157,41 @@ void eListbox::moveSelection(int dir) break; } + if (m_content->cursorValid() && !m_content->currentCursorSelectable()) + { + /* ok, our cursor position is valid (i.e. in list), but not selectable. */ + + /* when moving up, continue until we found a valid position. */ + if ((dir == moveUp) || (dir == pageDown)) + { + while (m_content->cursorGet()) + { + m_content->cursorMove(-1); + if (m_content->currentCursorSelectable()) + { + break; + } + } + } else + { + /* else move down */ + while (m_content->cursorValid()) + { + m_content->cursorMove(+1); + if (m_content->currentCursorSelectable()) + { + break; + } + } + + if (!m_content->cursorValid()) + m_content->cursorMove(-1); + } + + if (!m_content->currentCursorSelectable()) + m_content->cursorSet(oldsel); + } + /* note that we could be on an invalid cursor position, but we don't care. this only happens on empty lists, and should have almost no side effects. */ @@ -385,7 +420,6 @@ void eListbox::entryChanged(int index) void eListbox::entryReset(bool selectionHome) { - eDebug("entry reset"); m_content_changed = true; m_prev_scrollbar_page = -1;