Fix search results

This commit is contained in:
Carlos Zamora
2026-06-16 11:24:17 -07:00
parent 086eb06390
commit 27566acb71
3 changed files with 11 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
std::pair{ newTabMenuTag, L"\xE71D" }, /* All Apps */
std::pair{ extensionsTag, L"\xEA86" }, /* Puzzle */
std::pair{ profilesTag, L"\xE7EE" }, /* Other User */
std::pair{ globalProfileTag, L"\xE81E" }, /* Map Layers */
std::pair{ globalProfileTag, L"\xE7EE" }, /* Other User */
std::pair{ openJsonTag, L"\xE713" }, /* Settings */
};
}

View File

@@ -40,8 +40,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// This allows us to prioritize certain fields over others when scoring search results.
std::array<std::pair<std::optional<winrt::hstring>, int>, 2> LocalizedIndexEntry::GetSearchableFields() const
{
// Profile Defaults entries (DisplayTextUid starts with "Profile_") get a higher weight
const auto weight = til::starts_with(std::wstring_view{ Entry->ResourceName }, L"Profile_") ? WeightProfileDefaults : WeightDisplayTextLocalized;
// Profile Defaults entries get a higher weight so they rank above per-profile matches.
const auto weight = (std::wstring_view{ Entry->NavigationArgTag } == globalProfileTag) ? WeightProfileDefaults : WeightDisplayTextLocalized;
return { { { std::optional<winrt::hstring>{ DisplayTextLocalized }, weight },
{ DisplayTextNeutral, WeightDisplayTextNeutral } } };
}

View File

@@ -25,7 +25,9 @@ $ProhibitedUids = @(
"ColorScheme_ColorsHeader",
"ColorScheme_Rename",
"Profile_ResetProfile",
"Profile_DeleteProfile"
"Profile_DeleteProfile",
"Profiles_ColorSchemesNavigator",
"Profiles_DefaultsNavigator"
)
# Prohibited XAML files (already limited to Page root elements)
@@ -57,6 +59,7 @@ $ClassMap = @{
ResourceName = "Nav_ColorSchemes/Content"
NavigationParam = "ColorSchemes_Nav"
SubPage = "BreadcrumbSubPage::None"
SecondaryLabel = "Nav_Profiles/Content"
}
"Microsoft::Terminal::Settings::Editor::Rendering" = @{
ResourceName = "Nav_Rendering/Content"
@@ -248,12 +251,15 @@ foreach ($xamlFile in Get-ChildItem -Path $SourceDir -Filter *.xaml)
if ($includeInBuildIndex)
{
# Profiles > Defaults results should show "Profiles" as secondary label
$buildSecondaryLabel = $navigationParam -eq "GlobalProfile_Nav" ? "Nav_Profiles/Content" : $null
$entries += [pscustomobject]@{
ResourceName = "$($settingContainer.Uid)/Header"
ParentPage = $pageClass
NavigationParam = $navigationParam
SubPage = $subPage
ElementName = $name
SecondaryLabel = $buildSecondaryLabel
File = $filename
}
}
@@ -456,4 +462,4 @@ Set-Content -LiteralPath $cppPath -Value $cpp -NoNewline
Write-Host "Generated:"
Write-Host " $headerPath"
Write-Host " $cppPath"
Write-Host " $cppPath"