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

Add suppressApplicationTitle as boolean #2814

Merged
merged 20 commits into from
Nov 22, 2019

Conversation

cinnamon-msft
Copy link
Contributor

Summary of the Pull Request

Add suppressApplicationTitle as a setting

References

PR Checklist

  • Closes "suppressApplicationTitle" doesn't work (or exist.) #2645
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

If there's no tabTitle, suppressApplicationTitle does nothing
If suppressApplicationTitle is set to false, tabTitle acts as normal
If they both exist, tabTitle persists as the tab title

@cinnamon-msft cinnamon-msft requested a review from a team September 19, 2019 17:33
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

A few questions here

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Sep 24, 2019
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Oct 1, 2019
@ghost
Copy link

ghost commented Oct 1, 2019

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@DHowett-MSFT DHowett-MSFT removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Oct 7, 2019
@thongtrinh2204
Copy link

hi @cinnamon-msft @zadjii-msft do we have any update on it? i really need this feature for WSL.

@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-Terminal The new Windows Terminal. labels Oct 24, 2019
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Oct 24, 2019
@ghost
Copy link

ghost commented Oct 24, 2019

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@cinnamon-msft cinnamon-msft added the Help Wanted We encourage anyone to jump in on these. label Oct 24, 2019
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 24, 2019
@cinnamon-msft cinnamon-msft removed the Help Wanted We encourage anyone to jump in on these. label Nov 16, 2019
@cinnamon-msft cinnamon-msft self-assigned this Nov 16, 2019
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.

Couple questions here - I really don't think that we need startingTitle down in the Terminal core, but I could be wrong

_title = title;

if (_suppressApplicationTitle)
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we just not call _pfnTitleChanged when _suppressApplicationTitle is true? That would negate the need to the Terminal core to know about startingTitle, it would just not send title change events at all.

Maybe the _pfnTitleChanged needs to be called on the first time through this method, but not on subsequent calls...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we don't call _pfnTitleChanged when _suppressApplicationTitle is true, refocusing on the tab/pane within the tab (term.GotFocus() in TerminalPage.cpp) will call that tab's stored title, which is stored as the application title.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we could just set _title to StartingTitle as early as possible (when we apply the settings), and then we never have to make the check here on 368-373. Then, we can just simplify the code in here to:

if (!_suppressApplicationTitle)
{
    _title = title;
    if (_pfnTitleChanged)
    {
        _pfnTitleChanged(_title)
    }
}
return true;

and that's it. We never update _title, we never check if it's empty (settings always sets it), we don't have to store _startingTitle separately 😄

@@ -162,12 +162,14 @@ class Microsoft::Terminal::Core::Terminal final :
std::unique_ptr<::Microsoft::Console::VirtualTerminal::TerminalInput> _terminalInput;

std::wstring _title;
std::wstring_view _startingTitle;
Copy link
Member

Choose a reason for hiding this comment

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

I'm mildly concerned about storing this as a wstring_view. Won't this explode when the method that sets this goes out of scope, as the backing wstring gets freed?

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Minor nits. Not worth blocking.

@@ -93,6 +94,7 @@ Profile::Profile(const std::optional<GUID>& guid) :
_selectionBackground{},
_colorTable{},
_tabTitle{},
_suppressApplicationTitle{},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_suppressApplicationTitle{},
_suppressApplicationTitle{ false },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this only if it's set false as default?

_title = title;

if (_suppressApplicationTitle)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we could just set _title to StartingTitle as early as possible (when we apply the settings), and then we never have to make the check here on 368-373. Then, we can just simplify the code in here to:

if (!_suppressApplicationTitle)
{
    _title = title;
    if (_pfnTitleChanged)
    {
        _pfnTitleChanged(_title)
    }
}
return true;

and that's it. We never update _title, we never check if it's empty (settings always sets it), we don't have to store _startingTitle separately 😄

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 20, 2019
@cinnamon-msft cinnamon-msft force-pushed the cinnamon/suppress-application-title branch from 5d96c7a to 5badf2c Compare November 21, 2019 17:24
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

I concur with the one outstanding comment from Mike and Dustin and would like to see the resolution before I sign.

@DHowett-MSFT
Copy link
Contributor

My comment no longer applies, and we reverted the code that make it happen because it was actually worse

@zadjii-msft zadjii-msft dismissed their stale review November 21, 2019 23:07

I'm dismissing myself so I no longer block - I'm thoroughly confused about the state of this re: Dustin's comments, so I'm handing off to him

@cinnamon-msft cinnamon-msft merged commit 99a8337 into master Nov 22, 2019
@cinnamon-msft cinnamon-msft deleted the cinnamon/suppress-application-title branch November 22, 2019 00:18
@ghost
Copy link

ghost commented Nov 26, 2019

🎉Windows Terminal Preview v0.7.3291.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"suppressApplicationTitle" doesn't work (or exist.)
6 participants