Skip to content

Commit 14bab6c

Browse files
committed
more polish; more bugs found; I guess it's a stalemate
1 parent be2b1d3 commit 14bab6c

File tree

5 files changed

+72
-26
lines changed

5 files changed

+72
-26
lines changed

src/cascadia/TerminalSettingsEditor/MainPage.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
862862
{
863863
_PreNavigateHelper();
864864

865+
// TODO CARLOS:
866+
// - should navigate to EditColorScheme, not ColorSchemes
867+
// - EditColorScheme::OnNavigatedTo needs to accept NavigateToColorSchemesArgs (or similar)
868+
// - EditColorScheme::OnNavigatedTo needs BringIntoViewWhenLoaded(args.ElementToFocus())
865869
const auto crumb = winrt::make<Breadcrumb>(box_value(colorSchemesTag), RS_(L"Nav_ColorSchemes/Content"), BreadcrumbSubPage::None);
866870
_breadcrumbs.Append(crumb);
867871
contentFrame().Navigate(xaml_typename<Editor::ColorSchemes>(), winrt::make<NavigateToColorSchemesArgs>(_colorSchemesPageVM, elementToFocus));
@@ -1380,7 +1384,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
13801384
results.reserve(1);
13811385
results.push_back(FilteredSearchResult::CreateNoResultsItem(sanitizedQuery));
13821386
}
1383-
#undef APPEND_RUNTIME_OBJECT_RESULTS
13841387

13851388
// Update the UI with the results
13861389
const auto& searchBox = SettingsSearchBox();

src/cascadia/TerminalSettingsEditor/NewTabMenuViewModel.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,19 +455,20 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
455455
Collections::IObservableVector<Editor::FolderEntryViewModel> NewTabMenuViewModel::FolderTreeFlatList() const
456456
{
457457
std::vector<Editor::FolderEntryViewModel> flatList;
458-
std::function<void(const IVector<Editor::NewTabMenuEntryViewModel>&)> addFoldersRecursively;
459-
addFoldersRecursively = [&flatList, &addFoldersRecursively](const IVector<Editor::NewTabMenuEntryViewModel>& entries) {
460-
for (const auto& entry : entries)
458+
_FolderTreeFlatListImpl(_rootEntries, flatList);
459+
return single_threaded_observable_vector<Editor::FolderEntryViewModel>(std::move(flatList));
460+
}
461+
462+
void NewTabMenuViewModel::_FolderTreeFlatListImpl(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entriesToAdd, std::vector<Editor::FolderEntryViewModel>& flatList)
463+
{
464+
for (const auto& entry : entriesToAdd)
465+
{
466+
if (const auto& folderVM = entry.try_as<Editor::FolderEntryViewModel>())
461467
{
462-
if (const auto& folderVM = entry.try_as<Editor::FolderEntryViewModel>())
463-
{
464-
flatList.push_back(folderVM);
465-
addFoldersRecursively(folderVM.Entries());
466-
}
468+
flatList.push_back(folderVM);
469+
_FolderTreeFlatListImpl(folderVM.Entries(), flatList);
467470
}
468-
};
469-
addFoldersRecursively(_rootEntries);
470-
return single_threaded_observable_vector<Editor::FolderEntryViewModel>(std::move(flatList));
471+
}
471472
}
472473

473474
// This recursively constructs the FolderTree

src/cascadia/TerminalSettingsEditor/NewTabMenuViewModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
6868
Windows::Foundation::Collections::IObservableVector<Editor::NewTabMenuEntryViewModel>::VectorChanged_revoker _rootEntriesChangedRevoker;
6969

7070
static bool _IsRemainingProfilesEntryMissing(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entries);
71+
static void _FolderTreeFlatListImpl(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entriesToAdd, std::vector<Editor::FolderEntryViewModel>& flatList);
7172
void _FolderPropertyChanged(const IInspectable& sender, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);
7273
};
7374

src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,6 @@
24732473
</data>
24742474
<data name="Search_NoResults" xml:space="preserve">
24752475
<value>No results for "{}"</value>
2476-
<comment>{Locked=""{}""} Displayed when no results were found for a given query. "{}" will be replaced with the query.</comment>
2476+
<comment>{Locked="{}"} Displayed when no results were found for a given query. "{}" will be replaced with the query.</comment>
24772477
</data>
24782478
</root>

tools/GenerateSettingsIndex.ps1

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ param(
1919

2020
# Prohibited UIDs (exact match, case-insensitive by default)
2121
$ProhibitedUids = @(
22-
# TODO CARLOS: AddRemainingProfiles should probably be allowed
23-
'NewTabMenu_AddRemainingProfiles',
24-
'Extensions_Scope'
22+
'Extensions_Scope',
23+
'Profile_MissingFontFaces',
24+
'Profile_ProportionalFontFaces',
25+
'ColorScheme_InboxSchemeDuplicate',
26+
'ColorScheme_ColorsHeader',
27+
'ColorScheme_Rename'
2528
)
2629

2730
# Prohibited XAML files
@@ -130,7 +133,7 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
130133
HelpTextUid = "std::nullopt"
131134
HelpTextLocalized = "std::nullopt"
132135
ParentPage = $pageClass
133-
NavigationParam = "winrt::box_value(hstring{L`"Appearance_Nav`"})"
136+
NavigationParam = "winrt::box_value(hstring{L`"GlobalAppearance_Nav`"})"
134137
SubPage = "BreadcrumbSubPage::None"
135138
ElementName = 'L""'
136139
File = $filename
@@ -234,6 +237,46 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
234237
File = $filename
235238
}
236239
}
240+
elseif ($filename -eq 'Profiles_Base.xaml')
241+
{
242+
$entries += [pscustomobject]@{
243+
DisplayTextUid = "L`"Nav_ProfileDefaults/Content`""
244+
DisplayTextLocalized = "RS_(L`"Nav_ProfileDefaults/Content`")"
245+
HelpTextUid = "std::nullopt"
246+
HelpTextLocalized = "std::nullopt"
247+
ParentPage = $pageClass
248+
NavigationParam = "winrt::box_value(hstring{L`"GlobalProfile_Nav`"})"
249+
SubPage = "BreadcrumbSubPage::None"
250+
ElementName = 'L""'
251+
File = $filename
252+
}
253+
}
254+
elseif ($filename -eq 'AddProfile.xaml')
255+
{
256+
$entries += [pscustomobject]@{
257+
DisplayTextUid = "L`"Nav_AddNewProfile/Content`""
258+
DisplayTextLocalized = "RS_(L`"Nav_AddNewProfile/Content`")"
259+
HelpTextUid = "std::nullopt"
260+
HelpTextLocalized = "std::nullopt"
261+
ParentPage = $pageClass
262+
NavigationParam = "winrt::box_value(hstring{L`"AddProfile`"})"
263+
SubPage = "BreadcrumbSubPage::None"
264+
ElementName = 'L""'
265+
File = $filename
266+
}
267+
268+
$entries += [pscustomobject]@{
269+
DisplayTextUid = "L`"AddProfile_AddNewTextBlock/Text`""
270+
DisplayTextLocalized = "RS_(L`"AddProfile_AddNewTextBlock/Text`")"
271+
HelpTextUid = "std::nullopt"
272+
HelpTextLocalized = "std::nullopt"
273+
ParentPage = $pageClass
274+
NavigationParam = "winrt::box_value(hstring{L`"AddProfile`"})"
275+
SubPage = "BreadcrumbSubPage::None"
276+
ElementName = 'L"AddNewButton"'
277+
File = $filename
278+
}
279+
}
237280

238281
# Find all local:SettingContainer start tags
239282
$pattern = '<local:SettingContainer\b([^>/]*)(/?>)'
@@ -313,17 +356,8 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
313356
}
314357
elseif ($pageClass -match 'Editor::Extensions')
315358
{
316-
# TODO CARLOS: There's actually no UIDs for extension view! But I want the page to still exist in the index at runtime for each extension.
317-
#if ($uid -match 'NewTabMenu_CurrentFolder')
318-
#{
319-
# $navigationParam = 'vm'
320-
# $subPage = 'BreadcrumbSubPage::Extensions_Extension'
321-
#}
322-
#else
323-
#{
324359
$navigationParam = 'Extensions_Nav'
325360
$subPage = 'BreadcrumbSubPage::None'
326-
#}
327361
}
328362
elseif ($pageClass -match 'Editor::Profiles_Base' -or
329363
$pageClass -match 'Editor::Profiles_Appearance' -or
@@ -337,6 +371,13 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
337371
{
338372
# populate with color scheme name at runtime
339373
$navigationParam = 'nullptr'
374+
375+
# TODO CARLOS: Not sure if I need this. Turns out the issue is that EditColorScheme doesn't have a BringIntoViewWhenLoaded()!
376+
if ($uid -match 'ColorScheme_SetAsDefault')
377+
{
378+
# SetAsDefault should focus SetAsDefaultButton, not wrapping SetAsDefaultContainer
379+
$name = 'SetAsDefaultButton'
380+
}
340381
}
341382
elseif ($pageClass -match 'Editor::GlobalAppearance')
342383
{

0 commit comments

Comments
 (0)