From 4091fdbfdd31324132c0c6d9e5406f5f1b4b9d33 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sat, 18 Apr 2026 15:37:09 +0800 Subject: [PATCH] fix: defer auto-select until programs loaded to prevent wrong search result selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When search results refresh mid-collection, OnRefresh auto-selects the first result item. If programs haven't loaded yet, Settings category appears first and gets selected. If user hits Enter in that window, wrong item launches. Skip auto-select when search is still in progress and no programs have been found yet. Next refresh after programs load will select correctly. Fixes Open-Shell/Open-Shell-Menu#456 Fixes Open-Shell/Open-Shell-Menu#1982 Fixes Open-Shell/Open-Shell-Menu#4 > 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Src/StartMenu/StartMenuDLL/MenuContainer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp index 52ed2c738..856ead1e4 100644 --- a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp +++ b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp @@ -6366,7 +6366,10 @@ LRESULT CMenuContainer::OnRefresh( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL } } else if (m_Items[m_OriginalCount].id==MENU_SEARCH_CATEGORY) - hotItem=m_OriginalCount+1; + { + if (!bSearching || !s_SearchResults.programs.empty()) + hotItem=m_OriginalCount+1; + } } else hotItem=-1;