diff --git a/src/views/gamelist/BasicGameListView.cpp b/src/views/gamelist/BasicGameListView.cpp index a45916614..3cf3eccc0 100644 --- a/src/views/gamelist/BasicGameListView.cpp +++ b/src/views/gamelist/BasicGameListView.cpp @@ -58,6 +58,26 @@ void BasicGameListView::setCursor(FileData* cursor) { populateList(cursor->getParent()->getChildren()); mList.setCursor(cursor); + + // update our cursor stack in case our cursor just got set to some folder we weren't in before + if(mCursorStack.empty() || mCursorStack.top() != cursor->getParent()) + { + std::stack tmp; + FileData* ptr = cursor->getParent(); + while(ptr && ptr != mRoot) + { + tmp.push(ptr); + ptr = ptr->getParent(); + } + + // flip the stack and put it in mCursorStack + mCursorStack = std::stack(); + while(!tmp.empty()) + { + mCursorStack.push(tmp.top()); + tmp.pop(); + } + } } }