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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user