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 an ENUM setting for disabling rendering "intense" text as bold #10759

Merged
14 commits merged into from
Aug 16, 2021

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Jul 22, 2021

Summary of the Pull Request

This adds a new setting intenseTextStyle. It's a per-appearance, control setting, defaulting to "all".

  • When set to "all" or ["bold", "bright"], then we'll render text as both bold and bright (1.10 behavior)
  • When set to "bold", ["bold"], we'll render text formatted with ^[[1m as bold, but not bright
  • When set to "bright", ["bright"], we'll render text formatted with ^[[1m as bright, but not bold. This is the pre 1.10 behavior
  • When set to "none", we won't do anything special for it at all.

references

PR Checklist

Validation Steps Performed

image

Yea that works. Printed some bold text, toggled it on, the text was no longer bold. hooray.

EDIT, 10 Aug

"intenseTextStyle": "none",
"intenseTextStyle": "bold",
"intenseTextStyle": "bright",
"intenseTextStyle": "all",
"intenseTextStyle": ["bold", "bright"],

all work now. Repro script:

printf "\e[1m[bold]\e[m[normal]\e[34m[blue]\e[1m[bold blue]\e[m\n"

@ghost ghost added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues 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 Jul 22, 2021
@@ -256,6 +257,7 @@ namespace Microsoft::Console::Render
D2D1_TEXT_ANTIALIAS_MODE _antialiasingMode;

float _defaultTextBackgroundOpacity;
bool _intenseIsBold;
Copy link
Member

Choose a reason for hiding this comment

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

nit: you can initialize this in the class body if you want.

@j4james
Copy link
Collaborator

j4james commented Jul 24, 2021

When set to "none", we won't. (the pre-1.10 behavior)

This sounds wrong to me. If the long term plan is to allow the choice of "none", "bright", "bold", and "all", then the pre-1.10 behavior is "bright" rather than "none".

@zadjii-msft
Copy link
Member Author

This sounds wrong to me. If the long term plan is to allow the choice of "none", "bright", "bold", and "all", then the pre-1.10 behavior is "bright" rather than "none".

Sorry yea, that is a little confusing. Right now, there's only two values that the settings will actually accept - bold and none. none will still do the bright thing that we've always done right now, until we come through and actually add support for the bright setting. Then none will be (not bright, not bold).

I'm not sure I can fiddle with the enum parsing enough in this PR to make it so the only options are some set of bold, bright, and all. Maybe this PR doesn't make any sense at all without also doing the bright setting (though that's harder 😕)

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.

Don't forget to update the schema and the docs! (only reason I'm blocking)

Everything else is a suggestion.

Comment on lines 14 to 15
Boolean IntenseIsBold;
// Boolean IntenseIsBright;
Copy link
Member

Choose a reason for hiding this comment

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

Why is IntenseStyle declared in the Microsoft.Terminal.Settings.Model instead of the Microsoft.Terminal.Control namespace? I guess you need to convert the enum into two bools at some point, but it's just weird to see two super similar settings in one place imo.

src/cascadia/TerminalSettingsModel/AppearanceConfig.h Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 26, 2021
@j4james
Copy link
Collaborator

j4james commented Jul 26, 2021

Right now, there's only two values that the settings will actually accept - bold and none.

Maybe I'm not understanding how these mappings work, but if those are the actual values that are going to be saved in the settings file when a user toggles the "Render intense text as bold" option, then surely that setting is guaranteed to be incorrect at some point in the future?

For example, if a user turns this option off (so the setting becomes none), SGR 1 will still show as bright for now, but will eventually stop working altogether. Even when it's turned on, it's going to change from bold+bright to just bold. We're almost certain to receive a whole lot of bug reports when that happens.

If it can't be avoided, so be it. I just wanted to be sure you were aware of the problem. And if I've just misunderstood how it's going to work, sorry for the noise.

@skyline75489
Copy link
Collaborator

none will still do the bright thing that we've always done right now, until we come through and actually add support for the bright setting. Then none will be will be (not bright, not bold).

Yea I agree with @j4james , this change of behavior will result in huge amount of bug reports.

this PR doesn't make any sense at all without also doing the bright setting

Adding the bright setting is likely the correct solution here 😦

@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Aug 3, 2021
@ghost
Copy link

ghost commented Aug 3, 2021

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.

@zadjii-msft zadjii-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 Aug 3, 2021
@zadjii-msft
Copy link
Member Author

shh bot, I'm coming back to this

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.

Don't forget to update the schema and the docs! (only reason I'm blocking)

Everything else is a suggestion.

@@ -600,6 +601,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation

_renderEngine->SetForceFullRepaintRendering(_settings.ForceFullRepaintRendering());
_renderEngine->SetSoftwareRendering(_settings.SoftwareRendering());

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

nit: unnecessary change

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 12, 2021
@ghost
Copy link

ghost commented Aug 12, 2021

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.

@DHowett
Copy link
Member

DHowett commented Aug 12, 2021

build failures :(

Comment on lines +1194 to +1211
<comment>Header for a control to select how "intense" text is formatted (bold, bright, both or none)</comment>
</data>
<data name="Appearance_IntenseTextStyleNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "intense text format" setting. When selected, "intense" text will not be rendered differently</comment>
</data>
<data name="Appearance_IntenseTextStyleBold.Content" xml:space="preserve">
<value>Bold</value>
<comment>An option to choose from for the "intense text format" setting. When selected, "intense" text will be rendered as bold text</comment>
</data>
<data name="Appearance_IntenseTextStyleBright.Content" xml:space="preserve">
<value>Bright</value>
<comment>An option to choose from for the "intense text format" setting. When selected, "intense" text will be rendered in a brighter color</comment>
</data>
<data name="Appearance_IntenseTextStyleAll.Content" xml:space="preserve">
<value>Both</value>
<comment>An option to choose from for the "intense text format" setting. When selected, "intense" text will be rendered as both bold text and in a brighter color</comment>
Copy link
Member

Choose a reason for hiding this comment

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

Worried about the wording here. The names are pretty short, and people may not know what "Intense Text Format" means. Should we do something more like Display "intense" text in... ...the normal font a bold font ...bright colors ...both bold font and bright colors?

Should we get more technical and mention SGR 1?

Copy link
Member

Choose a reason for hiding this comment

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

@cinnamon-msft what do you think? this is a button for users who "know what they're doing"

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm gonna guess that .1% of our users will know what SGR 1 is. I be 1% of the folks that upvoted #109 in the first place do - people just want bold.

I'm not a wordsmith, I'm just a lowly engineer

Copy link
Collaborator

Choose a reason for hiding this comment

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

As a point of comparison, Mintty has this option as a dropdown list with the label "Show bold", and with the choices "as font", "as color", or "as font & as color". XTerm just as the option to toggle the bold fonts (at least in the UI) with a checked menu item labelled "Bold Fonts". And Gnome Terminal just as the option to toggle the bright colors with a checkbox labelled "Show bold text in bright colors".

My recommendation would be something similar to what Mintty has, but with a little more detail, e.g.:

  • Show bold with brighter colors
  • Show bold with a heavier font weight
  • Show bold with both font weight and color

I think most people that are going to want to mess with this know that it's the "bold" functionality that they're tweaking. And what we're trying to differentiate is whether it affects the font or the color (or both).

Copy link
Member

Choose a reason for hiding this comment

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

@j4james I appreciate that! Thanks. We're gonna merge this as is to get the feature into selfhost/test builds and work on the wording from there. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

(we're gonna work on the wording in post)

@@ -11,6 +11,8 @@ namespace Microsoft.Terminal.Control
Windows.UI.Xaml.Media.Stretch BackgroundImageStretchMode;
Windows.UI.Xaml.HorizontalAlignment BackgroundImageHorizontalAlignment;
Windows.UI.Xaml.VerticalAlignment BackgroundImageVerticalAlignment;
Boolean IntenseIsBold;
// IntenseIsBright is in Core Appearance
Copy link
Member

Choose a reason for hiding this comment

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

technically both should be there, since eventually we'll push down the renderer right?

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO eventually is not today, and I'd rather be self-consistent with the state of the world and not what we expect the world to be (which may lead to confusion)

@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 Aug 12, 2021
Copy link
Collaborator

@skyline75489 skyline75489 left a comment

Choose a reason for hiding this comment

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

:shipit:

@DHowett
Copy link
Member

DHowett commented Aug 16, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ghost ghost merged commit a544f56 into main Aug 16, 2021
@ghost ghost deleted the dev/migrie/bold-setting-try-2 branch August 16, 2021 13:46
@DHowett DHowett added the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Aug 16, 2021
DHowett pushed a commit that referenced this pull request Aug 25, 2021
…10759)

This adds a new setting `intenseTextStyle`. It's a per-appearance, control setting, defaulting to `"all"`.
* When set to `"all"` or `["bold", "bright"]`, then we'll render text as both **bold** and bright (1.10 behavior)
* When set to `"bold"`, `["bold"]`, we'll render text formatted with `^[[1m` as **bold**, but not bright
* When set to `"bright"`, `["bright"]`, we'll render text formatted with `^[[1m` as bright, but not bold. This is the pre 1.10 behavior
* When set to `"none"`, we won't do anything special for it at all.

* I last did this in #10648. This time it's an enum, so we can add bright in the future. It's got positive wording this time.
* ~We will want to add `"bright"` as a value in the future, to disable the auto intense->bright conversion.~ I just did that now.
* #5682 is related

* [x] Closes #10576
* [x] I seriously don't think we have an issue for "disable intense is bright", but I'm not crazy, people wanted that, right? #2916 (comment) was the closest
* [x] I work here
* [x] Tests added/passed
* [x] MicrosoftDocs/terminal#381

<!-- ![image](https://user-images.githubusercontent.com/18356694/125480327-07f6b711-6bca-4c1b-9a76-75fc978c702d.png) -->
![image](https://user-images.githubusercontent.com/18356694/128929228-504933ee-cf50-43a2-9982-55110ba39191.png)

Yea that works. Printed some bold text, toggled it on, the text was no longer bold. hooray.

```json
"intenseTextStyle": "none",
"intenseTextStyle": "bold",
"intenseTextStyle": "bright",
"intenseTextStyle": "all",
"intenseTextStyle": ["bold", "bright"],
```

all work now. Repro script:
```sh
printf "\e[1m[bold]\e[m[normal]\e[34m[blue]\e[1m[bold blue]\e[m\n"
```
@DHowett DHowett removed the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Aug 25, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

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

Handy links:

@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-Rendering Text rendering, emoji, complex glyph & font-fallback issues 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. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a setting for disabling "intense is bold"
6 participants