diff --git a/source/UpdaterStateShowVersionsMenu.cpp b/source/UpdaterStateShowVersionsMenu.cpp index c9ec64e..62bc7c8 100644 --- a/source/UpdaterStateShowVersionsMenu.cpp +++ b/source/UpdaterStateShowVersionsMenu.cpp @@ -8,27 +8,26 @@ ApplicationState::eSubState UpdaterState::UpdateShowVersionsMenu(Input *input) { if (selectedOptionX != oldX) { selectedOptionY = 0; } else { - proccessMenuNavigationY(input, mTotalPackageCount); + auto &curPage = mVersionInfo[selectedOptionX]; + proccessMenuNavigationY(input, curPage.getPackagesCount(mOnlyRequired)); } int32_t offset = 0; bool stop = false; if (entrySelected(input)) { - for (auto &base : mVersionInfo) { + auto &curPage = mVersionInfo[selectedOptionX]; + for (auto &cat : curPage.getMutableCategory()) { if (stop) { break; } - for (auto &cat : base.getMutableCategory()) { - if (stop) { break; } - for (auto &package : cat.getMutablePackages()) { - if (!package.getRequired() && mOnlyRequired) { - continue; - } - if (offset == selectedOptionY) { - package.toggleSelect(); - stop = true; - break; - } - offset++; + for (auto &package : cat.getMutablePackages()) { + if (!package.getRequired() && mOnlyRequired) { + continue; } + if (offset == selectedOptionY) { + package.toggleSelect(); + stop = true; + break; + } + offset++; } } } diff --git a/source/utils/VersionCheck.h b/source/utils/VersionCheck.h index ae8b422..388e16a 100644 --- a/source/utils/VersionCheck.h +++ b/source/utils/VersionCheck.h @@ -454,6 +454,14 @@ namespace VersionCheck { } return res; } + + const size_t getPackagesCount(bool required) const { + size_t result = 0; + for (auto &cur : category) { + result += cur.getPackagesCount(required); + } + return result; + } }; using VersionInfo = std::vector;