Skip to content

Use the "base" profile for incoming handoff and new commands#11022

Merged
7 commits merged intomainfrom
dev/duhowett/profiles-defaults
Aug 25, 2021
Merged

Use the "base" profile for incoming handoff and new commands#11022
7 commits merged intomainfrom
dev/duhowett/profiles-defaults

Conversation

@DHowett
Copy link
Member

@DHowett DHowett commented Aug 23, 2021

This pull request introduces our first use of the "base" profile as an
actual profile. Incoming commandlines from wt foo and default
terminal handoffs will be hosted in the base profile.

THIS IS A BREAKING CHANGE for user behavior.

The original behavior where commandlines were hosted in the "default"
profile (in most cases, Windows PowerShell) led to user confusion: "why
does cmd use my powershell icon?" and "why does the title say
PowerShell?". Making this change unifies the user experience so that we
can land commandline detection in #10952.

Users who want the original behavior can get it back for commandline
invocation by specifying a profile using the -p argument, as in wt -p PowerShell -- cmd.

As a temporary stopgap, users who attempt to duplicate the base profile
will get their specified default profile until we land #5047.

This feature is hidden behind the same feature flag that controls the
visibility of base/"Defaults" in the settings UI.

Fixes #10669
Related to #6776

@DHowett DHowett marked this pull request as draft August 23, 2021 21:40
TerminalConnection::ITerminalConnection TerminalPage::_CreateConnectionFromSettings(Profile profile,
TerminalSettings settings)
{
if (!profile)
Copy link
Member Author

Choose a reason for hiding this comment

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

If we get here with a null profile, a crash report would be nice.

Copy link
Member

Choose a reason for hiding this comment

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

If you want, you could add an assert, I guess

@ghost ghost added Area-DefApp Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Aug 24, 2021
@DHowett DHowett marked this pull request as ready for review August 24, 2021 19:54
@DHowett DHowett requested review from carlos-zamora and zadjii-msft and removed request for zadjii-msft August 24, 2021 19:55
@carlos-zamora carlos-zamora added the Needs-Second It's a PR that needs another sign-off label Aug 25, 2021
@ghost ghost requested review from PankajBhojwani, leonMSFT, lhecker and miniksa August 25, 2021 17:34
}
VERIFY_ARE_EQUAL(L"foo.exe", termSettings.Commandline());
VERIFY_ARE_EQUAL(1, termSettings.HistorySize());
VERIFY_ARE_EQUAL(29, termSettings.HistorySize());
Copy link
Member Author

Choose a reason for hiding this comment

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

wait a minute, this has to go into the if above

{
const auto jsonString{ til::u16u8(json) };
_ParseJsonString(jsonString, false);
_ApplyDefaultsFromUserSettings();
Copy link
Member Author

Choose a reason for hiding this comment

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

this method is only used in the tests; adding this ensures that ProfileDefaults() is populated :|

we gotta fix this yo

}

return FindProfile(til::coalesce_value(profileByName, profileByIndex, _globals->DefaultProfile()));
if (profileByName)
Copy link
Member

Choose a reason for hiding this comment

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

Okay so _GetProfileGuidByName is going to return nullopt because the profile is L"". profileByIndex is definitely nullopt, so we fall through.

there are new terminal args, and the commandline isn't empty, so we use the base layer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(settings, realArgs.TerminalArgs(), nullptr) };
const auto termSettings = settingsStruct.DefaultSettings();
VERIFY_ARE_EQUAL(guid0, profile.Guid());
if constexpr (Feature_ShowProfileDefaultsInSettings::IsEnabled())
Copy link
Member

Choose a reason for hiding this comment

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

is it even possible to run these tests in both configurations? These things get compiled in presumably. Huh. Interesting. I'm not even sure which one would get built by default, presumably, the same as a dev build? Every feature on?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct! It's disabled in release, and somebody would have to specifically build with release branding to get this path

Copy link
Member Author

Choose a reason for hiding this comment

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

or, the other path

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 25, 2021
@ghost
Copy link

ghost commented Aug 25, 2021

Hello @DHowett!

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 ea58e40 into main Aug 25, 2021
@ghost ghost deleted the dev/duhowett/profiles-defaults branch August 25, 2021 22:41
@ghost
Copy link

ghost commented Aug 31, 2021

🎉Windows Terminal Preview v1.11.2421.0 has been released which incorporates this pull request.:tada:

Handy links:

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-DefApp Area-Settings Issues related to settings and customizability, for console or terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Launching any cli app(such as powershell, wsl) sets the tab's icon as the default profile's icon

3 participants