Skip to content

Bugfix: sync color scheme rename with profile reference#8793

Merged
7 commits merged intomainfrom
dev/cazamor/sui/sync-color-scheme
Jan 22, 2021
Merged

Bugfix: sync color scheme rename with profile reference#8793
7 commits merged intomainfrom
dev/cazamor/sui/sync-color-scheme

Conversation

@carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Jan 14, 2021

Summary of the Pull Request

This fixes a bug where renaming/deleting a color scheme would not update profiles that referenced it.

This also adds detection for renaming a color scheme to a name that is already in use, and adds appropriate UI for that.

References

#6800 - Settings UI Epic

PR Checklist

Detailed Description of the Pull Request / Additional comments

Model::CascadiaSettings was updated to have a UpdateColorSchemeReferences() function that updates all profiles referencing the newly renamed color scheme.

Editor::ColorSchemesPageNavigationState now takes and exposes a Model::CascadiaSettings.

When a color scheme is renamed or deleted, we use CascadiaSettings to update our list of color schemes appropriately, then call UpdateColorSchemeReferences() to update the profiles.

The tricky part is that Profile does not store a direct reference to ColorScheme, but rather the name of the color scheme. See this tread for a discussion on this topic.

Validation Steps Performed

Repro steps from #8756 when renaming/deleting a referenced color scheme.

Demo

Scheme Name Already In Use Demo

@ghost ghost added Area-SettingsUI Anything specific to the SUI Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. labels Jan 14, 2021
@carlos-zamora

This comment has been minimized.

@carlos-zamora carlos-zamora force-pushed the dev/cazamor/sui/sync-color-scheme branch from 40fa7ab to aacc4e4 Compare January 21, 2021 23:08
@carlos-zamora carlos-zamora marked this pull request as ready for review January 22, 2021 01:02
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 22, 2021
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 22, 2021
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it. thank you. EXCELLENT addition w/ the new teaching tip.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very clever, I like it

@DHowett
Copy link
Member

DHowett commented Jan 22, 2021

Before you merge this, please update the PR body. It describes the old implementation.

@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 22, 2021
@ghost
Copy link

ghost commented Jan 22, 2021

Hello @carlos-zamora!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 9700598 into main Jan 22, 2021
@ghost ghost deleted the dev/cazamor/sui/sync-color-scheme branch January 22, 2021 18:21
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
## Summary of the Pull Request
This fixes a bug where renaming/deleting a color scheme would not update profiles that referenced it.

This also adds detection for renaming a color scheme to a name that is already in use, and adds appropriate UI for that.

## References
microsoft#6800 - Settings UI Epic

## PR Checklist
* [X] Closes microsoft#8756 

## Detailed Description of the Pull Request / Additional comments
`Model::CascadiaSettings` was updated to have a `UpdateColorSchemeReferences()` function that updates all profiles referencing the newly renamed color scheme.

`Editor::ColorSchemesPageNavigationState` now takes and exposes a `Model::CascadiaSettings`.

When a color scheme is renamed or deleted, we use `CascadiaSettings` to update our list of color schemes appropriately, then call `UpdateColorSchemeReferences()` to update the profiles.

The tricky part is that `Profile` does not store a direct reference to `ColorScheme`, but rather the name of the color scheme. See [this tread](microsoft#8756 (comment)) for a discussion on this topic.

## Validation Steps Performed
Repro steps from microsoft#8756 when renaming/deleting a referenced color scheme.

## Demo
![Scheme Name Already In Use Demo](https://user-images.githubusercontent.com/11050425/105431427-6e023980-5c0a-11eb-894a-42152fc77f05.gif)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-SettingsUI Anything specific to the SUI AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a color scheme used by a profile should properly update the profile

3 participants