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
+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