From 5098809e147c44d910f150a4fa3488af695b39e9 Mon Sep 17 00:00:00 2001 From: Michael Jolley Date: Tue, 13 Jan 2026 19:52:38 -0600 Subject: [PATCH] Devaluing fallback ranks in global sort (#44691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #44630 Devaluing fallback ranks by 50% so direct matches are ranked higher. --------- Co-authored-by: Jiří Polášek --- .../Commands/MainListPage.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs index 2489cd0817..2ee8f1e357 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs @@ -547,6 +547,15 @@ public partial class MainListPage : DynamicListPage, // above "git" from "whatever" max = max + extensionTitleMatch; + // Apply a penalty to fallback items so they rank below direct matches. + // Fallbacks that dynamically match queries (like RDP connections) should + // appear after apps and direct command matches. + if (isFallback && max > 1) + { + // Reduce fallback scores by 50% to prioritize direct matches + max = max * 0.5; + } + var matchSomething = max + (isAliasMatch ? 9001 : (isAliasSubstringMatch ? 1 : 0));