Skip to content

Commit 532343f

Browse files
committed
runtime object indexing
1 parent 2a41f8a commit 532343f

File tree

9 files changed

+114
-125
lines changed

9 files changed

+114
-125
lines changed

src/cascadia/TerminalSettingsEditor/Actions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
3030
const auto args = e.Parameter().as<Editor::NavigateToActionsArgs>();
3131
_ViewModel = args.ViewModel();
3232

33-
// TODO CARLOS: runtime indexing and retrieval support
3433
BringIntoViewWhenLoaded(args.ElementToFocus());
3534

3635
// Subscribe to the view model's FocusContainer event.

src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
3939
_ViewModel = args.ViewModel();
4040
_ViewModel.CurrentPage(ColorSchemesSubPage::Base);
4141

42-
// TODO CARLOS: runtime indexing and retrieval support
4342
BringIntoViewWhenLoaded(args.ElementToFocus());
4443

4544
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {

src/cascadia/TerminalSettingsEditor/Extensions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
4141
vmImpl->LazyLoadExtensions();
4242
vmImpl->MarkAsVisited();
4343

44-
// TODO CARLOS: runtime indexing and retrieval support
4544
BringIntoViewWhenLoaded(args.ElementToFocus());
4645

4746
if (vmImpl->IsExtensionView())

src/cascadia/TerminalSettingsEditor/MainPage.cpp

Lines changed: 62 additions & 109 deletions
Large diffs are not rendered by default.

src/cascadia/TerminalSettingsEditor/MainPage.h

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
7171

7272
bool IsNoResultsPlaceholder() const
7373
{
74-
return _overrideLabel.has_value();
74+
return _overrideLabel.has_value() && !_NavigationArgOverride;
7575
}
7676

7777
const LocalizedIndexEntry& SearchIndexEntry() const noexcept
@@ -94,7 +94,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
9494

9595
private:
9696
const std::optional<winrt::hstring> _overrideLabel{ std::nullopt };
97-
const Windows::Foundation::IInspectable& _NavigationArgOverride{ nullptr };
97+
const Windows::Foundation::IInspectable _NavigationArgOverride{ nullptr };
9898
const LocalizedIndexEntry* _SearchIndexEntry{ nullptr };
9999
};
100100

@@ -164,14 +164,31 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
164164
winrt::Microsoft::Terminal::Settings::Editor::NewTabMenuViewModel _newTabMenuPageVM{ nullptr };
165165
winrt::Microsoft::Terminal::Settings::Editor::ExtensionsViewModel _extensionsVM{ nullptr };
166166

167-
std::vector<LocalizedIndexEntry> _searchIndex;
168-
std::vector<LocalizedIndexEntry> _searchProfileIndex;
169-
std::vector<LocalizedIndexEntry> _searchNTMFolderIndex;
170-
std::vector<LocalizedIndexEntry> _searchColorSchemeIndex;
171-
til::generational<std::vector<const LocalizedIndexEntry*>> _filteredSearchIndex;
172-
std::vector<const LocalizedIndexEntry*> _filteredSearchProfileIndex;
173-
std::vector<const LocalizedIndexEntry*> _filteredSearchNTMFolderIndex;
174-
std::vector<const LocalizedIndexEntry*> _filteredSearchColorSchemeIndex;
167+
struct SearchIndex
168+
{
169+
SearchIndex& operator=(const SearchIndex& other) = default;
170+
171+
std::vector<LocalizedIndexEntry> mainIndex;
172+
std::vector<LocalizedIndexEntry> profileIndex;
173+
std::vector<LocalizedIndexEntry> ntmFolderIndex;
174+
std::vector<LocalizedIndexEntry> colorSchemeIndex;
175+
176+
// Links to main page; used when searching runtime objects (i.e. profile/extension name --> Profile_Base/Extension View)
177+
LocalizedIndexEntry profileIndexEntry;
178+
LocalizedIndexEntry ntmFolderIndexEntry;
179+
LocalizedIndexEntry colorSchemeIndexEntry;
180+
LocalizedIndexEntry extensionIndexEntry;
181+
};
182+
til::generational<SearchIndex> _searchIndex;
183+
184+
struct FilteredSearchIndex
185+
{
186+
std::vector<const LocalizedIndexEntry*> mainIndex;
187+
std::vector<const LocalizedIndexEntry*> profileIndex;
188+
std::vector<const LocalizedIndexEntry*> ntmFolderIndex;
189+
std::vector<const LocalizedIndexEntry*> colorSchemeIndex;
190+
};
191+
til::generational<FilteredSearchIndex> _filteredSearchIndex;
175192

176193
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _profileViewModelChangedRevoker;
177194
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _colorSchemesPageViewModelChangedRevoker;

src/cascadia/TerminalSettingsEditor/NewTabMenu.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
4646
const auto args = e.Parameter().as<Editor::NavigateToNewTabMenuArgs>();
4747
_ViewModel = args.ViewModel();
4848

49-
// TODO CARLOS: runtime indexing and retrieval support
5049
BringIntoViewWhenLoaded(args.ElementToFocus());
5150

5251
TraceLoggingWrite(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,7 @@
24722472
<comment>Placeholder text for the main search box in the settings editor.</comment>
24732473
</data>
24742474
<data name="Search_NoResults" xml:space="preserve">
2475-
<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>
2475+
<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>
24772477
</data>
24782478
</root>

src/cascadia/TerminalSettingsEditor/Utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#pragma once
55

6+
#include "SettingContainer.h"
7+
68
// This macro must be used alongside GETSET_BINDABLE_ENUM_SETTING.
79
// Use this in your class's constructor after Initialize_Component().
810
// It sorts and initializes the observable list of enum entries with the enum name

tools/GenerateSettingsIndex.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
428428
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex();
429429
430430
const IndexEntry& PartialProfileIndexEntry();
431+
const IndexEntry& PartialNTMFolderIndexEntry();
432+
const IndexEntry& PartialColorSchemeIndexEntry();
433+
const IndexEntry& PartialExtensionIndexEntry();
431434
}
432435
"@
433436

@@ -483,6 +486,24 @@ $( ($schemeEntries -join "`r`n") )
483486
static IndexEntry entry{ L"", std::nullopt, winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Profiles_Base>(), nullptr, BreadcrumbSubPage::None, L"" };
484487
return entry;
485488
}
489+
490+
const IndexEntry& PartialNTMFolderIndexEntry()
491+
{
492+
static IndexEntry entry{ L"", std::nullopt, winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::NewTabMenu>(), nullptr, BreadcrumbSubPage::NewTabMenu_Folder, L"" };
493+
return entry;
494+
}
495+
496+
const IndexEntry& PartialColorSchemeIndexEntry()
497+
{
498+
static IndexEntry entry{ L"", std::nullopt, winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::EditColorScheme>(), nullptr, BreadcrumbSubPage::ColorSchemes_Edit, L"" };
499+
return entry;
500+
}
501+
502+
const IndexEntry& PartialExtensionIndexEntry()
503+
{
504+
static IndexEntry entry{ L"", std::nullopt, winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Extensions>(), nullptr, BreadcrumbSubPage::Extensions_Extension, L"" };
505+
return entry;
506+
}
486507
}
487508
"@
488509

0 commit comments

Comments
 (0)