Skip to content

Commit 4d47cd5

Browse files
committed
cleanup
1 parent 0a11643 commit 4d47cd5

File tree

2 files changed

+9
-60
lines changed

2 files changed

+9
-60
lines changed

src/cascadia/TerminalApp/TerminalPage.cpp

+4-44
Original file line numberDiff line numberDiff line change
@@ -3306,59 +3306,19 @@ namespace winrt::TerminalApp::implementation
33063306

33073307
// Refresh UI elements
33083308

3309+
// Recreate the TerminalSettings cache here. We'll use that as we're
3310+
// updating terminal panes, so that we don't have to build a _new_
3311+
// TerminalSettings for every profile we update - we can just look them
3312+
// up the previous ones we built.
33093313
_terminalSettingsCache = TerminalApp::TerminalSettingsCache{ _settings, *_bindings };
33103314

3311-
// // Mapping by GUID isn't _excellent_ because the defaults profile doesn't have a stable GUID; however,
3312-
// // when we stabilize its guid this will become fully safe.
3313-
// std::unordered_map<winrt::guid, std::pair<Profile, TerminalSettingsCreateResult>> profileGuidSettingsMap;
3314-
// const auto profileDefaults{ _settings.ProfileDefaults() };
3315-
// const auto allProfiles{ _settings.AllProfiles() };
3316-
3317-
// profileGuidSettingsMap.reserve(allProfiles.Size() + 1);
3318-
3319-
// // Include the Defaults profile for consideration
3320-
// profileGuidSettingsMap.insert_or_assign(profileDefaults.Guid(), std::pair{ profileDefaults, nullptr });
3321-
// for (const auto& newProfile : allProfiles)
3322-
// {
3323-
// // Avoid creating a TerminalSettings right now. They're not totally cheap, and we suspect that users with many
3324-
// // panes may not be using all of their profiles at the same time. Lazy evaluation is king!
3325-
// profileGuidSettingsMap.insert_or_assign(newProfile.Guid(), std::pair{ newProfile, nullptr });
3326-
// }
3327-
33283315
for (const auto& tab : _tabs)
33293316
{
33303317
if (auto terminalTab{ _GetTerminalTabImpl(tab) })
33313318
{
33323319
// Let the tab know that there are new settings. It's up to each content to decide what to do with them.
33333320
terminalTab->UpdateSettings(_settings, _terminalSettingsCache);
33343321

3335-
// // FURTHERMORE We need to do a bit more work here for terminal
3336-
// // panes. They need to know about the profile that was used for
3337-
// // them, and about the focused/unfocused settings.
3338-
3339-
// // Manually enumerate the panes in each tab; this will let us recycle TerminalSettings
3340-
// // objects but only have to iterate one time.
3341-
// terminalTab->GetRootPane()->WalkTree([&](auto&& pane) {
3342-
// // If the pane isn't a terminal pane, it won't have a profile.
3343-
// if (const auto profile{ pane->GetProfile() })
3344-
// {
3345-
// const auto found{ profileGuidSettingsMap.find(profile.Guid()) };
3346-
// // GH#2455: If there are any panes with controls that had been
3347-
// // initialized with a Profile that no longer exists in our list of
3348-
// // profiles, we'll leave it unmodified. The profile doesn't exist
3349-
// // anymore, so we can't possibly update its settings.
3350-
// if (found != profileGuidSettingsMap.cend())
3351-
// {
3352-
// auto& pair{ found->second };
3353-
// if (!pair.second)
3354-
// {
3355-
// pair.second = TerminalSettings::CreateWithProfile(_settings, pair.first, *_bindings);
3356-
// }
3357-
// pane->UpdateTerminalSettings(pair.second, pair.first);
3358-
// }
3359-
// }
3360-
// });
3361-
33623322
// Update the icon of the tab for the currently focused profile in that tab.
33633323
// Only do this for TerminalTabs. Other types of tabs won't have multiple panes
33643324
// and profiles so the Title and Icon will be set once and only once on init.

src/cascadia/TerminalApp/TerminalSettingsCache.h

+5-16
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,13 @@ Copyright (c) Microsoft Corporation
33
Licensed under the MIT license.
44
55
Class Name:
6-
- ContentManager.h
6+
- TerminalSettingsCache.h
77
88
Abstract:
9-
- This is a helper class for tracking all of the terminal "content" instances of
10-
the Terminal. These are all the ControlInteractivity & ControlCore's of each
11-
of our TermControls. These are each assigned a GUID on creation, and stored in
12-
a map for later lookup.
13-
- This is used to enable moving panes between windows. TermControl's are not
14-
thread-agile, so they cannot be reused on other threads. However, the content
15-
is. This helper, which exists as a singleton across all the threads in the
16-
Terminal app, allows each thread to create content, assign it to a
17-
TermControl, detach it from that control, and reattach to new controls on
18-
other threads.
19-
- When you want to create a new TermControl, call CreateCore to instantiate a
20-
new content with a GUID for later reparenting.
21-
- Detach can be used to temporarily remove a content from its hosted
22-
TermControl. After detaching, you can still use LookupCore &
23-
TermControl::AttachContent to re-attach to the content.
9+
- This is a helper class used as we update the settings for panes. This class
10+
contains a single map of guid -> TerminalSettings, so that as we update all
11+
the panes during a settings reload, we only need to create a TerminalSettings
12+
once per profile.
2413
--*/
2514
#pragma once
2615

0 commit comments

Comments
 (0)