From 32ad90f17dadc2744da03d08ab6f4b28c361c3ea Mon Sep 17 00:00:00 2001 From: "Nicholas N." <51804513+nnyj@users.noreply.github.com> Date: Sat, 18 Apr 2026 21:18:23 +0800 Subject: [PATCH] Fix search auto-selecting wrong item before programs finish loading (#2451) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: defer auto-select until programs loaded to prevent wrong search result selection 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 52ed2c7..856ead1 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;