Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix profile selection upon discarding changes in SUI #10147

Merged
merged 1 commit into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsEditor/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
if (const auto& selectedItemProfileTag{ selectedItemTag.try_as<ProfileViewModel>() })
{
if (profileTag->Guid() == selectedItemProfileTag->Guid())
if (profileTag->OriginalProfileGuid() == selectedItemProfileTag->OriginalProfileGuid())
{
// found the one that was selected before the refresh
SettingsNav().SelectedItem(item);
Expand Down
6 changes: 6 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

ProfileViewModel::ProfileViewModel(const Model::Profile& profile, const Model::CascadiaSettings& appSettings) :
_profile{ profile },
_originalProfileGuid{ profile.Guid() },
_ShowAllFonts{ false },
_appSettings{ appSettings }
{
Expand Down Expand Up @@ -325,6 +326,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}

winrt::guid ProfileViewModel::OriginalProfileGuid() const noexcept
{
return _originalProfileGuid;
}

bool ProfileViewModel::CanDeleteProfile() const
{
const auto guid{ Guid() };
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalSettingsEditor/Profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ShowAllFonts(const bool& value);

// general profile knowledge
winrt::guid OriginalProfileGuid() const noexcept;
bool CanDeleteProfile() const;
WINRT_PROPERTY(bool, IsBaseLayer, false);

Expand Down Expand Up @@ -104,6 +105,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

private:
Model::Profile _profile;
winrt::guid _originalProfileGuid;
winrt::hstring _lastBgImagePath;
winrt::hstring _lastStartingDirectoryPath;
bool _ShowAllFonts;
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsEditor/Profiles.idl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace Microsoft.Terminal.Settings.Editor
Boolean ShowAllFonts;
Boolean UseCustomStartingDirectory { get; };
Boolean BackgroundImageSettingsVisible { get; };
Guid OriginalProfileGuid { get; };

OBSERVABLE_PROJECTED_PROFILE_SETTING(String, Name);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Guid, Guid);
Expand Down