fix(ui): stop global shortcuts auto-repeating; skip invalid skins

The global keyboard shortcuts tested keys without disabling key-repeat,
so holding one down fired it every frame: the theme cycle, balance and
market layout cycles, the effects and background toggles, the settings
and sidebar-collapse keys all re-triggered on a held key. Cycling themes
also stepped onto skins that had failed to load and wrote the broken
pick into settings.

- Every one-shot shortcut now checks for a fresh key press only, so a
  held key fires once.
- Theme cycling skips over invalid skins and only applies, persists, and
  shows the toast when a skin actually loads; if none can load, settings
  are left untouched and no toast appears.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 17:42:29 -05:00
co-authored by Claude Opus 4.8
parent 96352ce9ad
commit 95605dd7e9
4 changed files with 28 additions and 21 deletions
+1 -1
View File
@@ -774,7 +774,7 @@ inline bool RenderSidebar(NavPage& current, float sidebarWidth, float contentHei
do { idx++; } while (idx < (int)NavPage::Count_ && !IsNavPageVisible(static_cast<NavPage>(idx)));
if (idx < (int)NavPage::Count_) nav = true;
}
if (ImGui::IsKeyPressed(ImGuiKey_LeftBracket))
if (ImGui::IsKeyPressed(ImGuiKey_LeftBracket, false))
collapsed = !collapsed;
if (nav) { current = static_cast<NavPage>(idx); changed = true; }
}
+2 -2
View File
@@ -172,8 +172,8 @@ void RenderBalanceTab(App* app)
// Left/Right arrows: cycle through enabled balance layouts
// (skip when Ctrl is held — Ctrl+Arrow cycles themes instead)
if (app->settings() && !ImGui::GetIO().WantTextInput && !ImGui::GetIO().KeyCtrl) {
bool cycleUp = ImGui::IsKeyPressed(ImGuiKey_LeftArrow);
bool cycleDown = ImGui::IsKeyPressed(ImGuiKey_RightArrow);
bool cycleUp = ImGui::IsKeyPressed(ImGuiKey_LeftArrow, false);
bool cycleDown = ImGui::IsKeyPressed(ImGuiKey_RightArrow, false);
if (cycleUp || cycleDown) {
const auto& layouts = GetBalanceLayouts();
// Build list of enabled layout IDs
+2 -2
View File
@@ -2257,8 +2257,8 @@ void RenderMarketTab(App* app)
// portfolio editor / market-settings modal is open.
if (app->settings() && !s_pfEdit.open &&
!ImGui::GetIO().WantTextInput && !ImGui::GetIO().KeyCtrl) {
bool prev = ImGui::IsKeyPressed(ImGuiKey_LeftArrow);
bool next = ImGui::IsKeyPressed(ImGuiKey_RightArrow);
bool prev = ImGui::IsKeyPressed(ImGuiKey_LeftArrow, false);
bool next = ImGui::IsKeyPressed(ImGuiKey_RightArrow, false);
if (prev || next) {
int st = app->settings()->getPortfolioStyle();
st = next ? (st + 1) % 3 : (st + 2) % 3;