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

Set Tab tooltip explicitly #8298

Merged
8 commits merged into from Dec 17, 2020
Merged

Set Tab tooltip explicitly #8298

8 commits merged into from Dec 17, 2020

Conversation

ghost
Copy link

@ghost ghost commented Nov 17, 2020

Summary of the Pull Request

The tab tooltip is no longer empty when it was toggle zoomed.

References

PR Checklist

  • Closes Tab tooltip is empty when zooming pane #8199
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema 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

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. labels Nov 17, 2020
@mpela81
Copy link
Contributor

mpela81 commented Nov 17, 2020

Hi - I'd like to give my humble comments from a non-reviewer if you don't mind:

  • If you set the tooltip explicitly only when you are in zoomed mode, then when you exit zoom and switch to another pane, the tooltip is not updated automatically to reflect the selected pane. You may need to set it explicitly in all cases.
  • Is it required to set a Run+Textbox, instead of just the tabText?
  • If I remember correctly when I experimented on this, by default the 'explicit' tooltip is not positioned the same as the 'non-explicit' tooltip. You may need to adjust it.

@ghost
Copy link
Author

ghost commented Nov 18, 2020

@mpela81 From my experience it won't work if I don't use Run+Textbox.

@zadjii-msft zadjii-msft self-assigned this Nov 20, 2020
@DHowett
Copy link
Member

DHowett commented Nov 25, 2020

This will probably need to be updated for the new TabHeaderControl! 😄

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 30, 2020
@zadjii-msft
Copy link
Member

Hey thanks for putting this together - mind merging main into this branch? I'm fairly certain the work in #8227 is gonna end up conflicting with this PR a decent amount 😄

@zadjii-msft zadjii-msft assigned ghost and unassigned zadjii-msft Nov 30, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 1, 2020
@ghost
Copy link
Author

ghost commented Dec 1, 2020

I will update it for the new TabHeaderControl.

@ghost
Copy link
Author

ghost commented Dec 14, 2020

@DHowett I updated for TabHeaderControl!

@@ -290,7 +290,6 @@ namespace winrt::TerminalApp::implementation
Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e)
{
auto key = e.OriginalKey();
auto const ctrlDown = WI_IsFlagSet(CoreWindow::GetForCurrentThread().GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down);
Copy link
Member

Choose a reason for hiding this comment

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

This change doesn't seem related to fixing the tooltip in the tab header!

newTabRun.Text(tabTitle);
auto textBlock = WUX::Controls::TextBlock{};
textBlock.Inlines().Append(newTabRun);
toolTip.Content(textBlock);
Copy link
Member

Choose a reason for hiding this comment

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

we might be able to get away with tooltip.Content(winrt::box_value(tabTitle)) and avoid the Run and TextBlock completely. Does that work?

@@ -231,6 +242,7 @@ namespace winrt::TerminalApp::implementation

// Update the control to reflect the changed title
_headerControl.Title(activeTitle);
_SetToolTip(_GetActiveTitle());
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this is called at all the right times? How about during initialization when we set the first title

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 15, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 15, 2020
@ghost
Copy link
Author

ghost commented Dec 15, 2020

@DHowett I hope this is what you meant!

@zadjii-msft
Copy link
Member

Notes from playing with the branch:

  • The tooltip doesn't seem to change when the application changes the title
  • The tooltip doesn't change when the tab is renamed with the renamer
  • The tooltip does change when the tab zooms

Additionally

  • There's currently no tooltip on any tabs:
    image
    so this is definitely still an improvement

@ghost
Copy link
Author

ghost commented Dec 16, 2020

It seems like putting _SetToolTip() in _UpdateTitle() resolve all the issues above.

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.

This looks great. Thank you!

@@ -71,6 +70,13 @@ namespace winrt::TerminalApp::implementation
_RecalculateAndApplyTabColor();
}

void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle)
{
auto toolTip = WUX::Controls::ToolTip{};
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
auto toolTip = WUX::Controls::ToolTip{};
WUX::Controls::ToolTip toolTip{};

optional change to improve code readability. we usually don't use "auto x = type{y}" because auto is only good when you don't have to say the type. type x{y}; is shorter 😄

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 great, thanks!

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Dec 17, 2020
@ghost
Copy link

ghost commented Dec 17, 2020

Hello @zadjii-msft!

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 b8e6b8e into microsoft:main Dec 17, 2020
@ghost
Copy link

ghost commented Jan 28, 2021

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

Handy links:

@ghost ghost mentioned this pull request Jan 28, 2021
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
The tab tooltip is no longer empty when it was toggle zoomed.
<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes microsoft#8199 
* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema 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

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
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-User Interface Issues pertaining to the user interface of the Console or Terminal 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-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tab tooltip is empty when zooming pane
4 participants