X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/5a6917c166569dee402a82e384ec85d7adf61fa7..25978791bdc8abdf339026a74036fa17ebb19053:/lib/gui/elistbox.cpp diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index d9f95c4b..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. */