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 bold, italic, and underline for copyFormatting #16193

Closed
wants to merge 3 commits into from

Conversation

ChaseKnowlden
Copy link

Summary of the Pull Request

copyFormatting was broken when pasting into Word.

References and Relevant Issues

#16191

Detailed Description of the Pull Request / Additional comments

Fixes formatting issues with text.

Validation Steps Performed

  1. Open Vim
  2. Use Font variant ignored by copyFormatting #16191 for an example.
  3. Formats correctly.

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Oct 19, 2023
htmlBuilder << ";";
htmlBuilder << "font-style:";
htmlBuilder << textProps.IsItalic();
htmlBuilder << ";";
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 somewhat doubtful that this works correctly, because these 3 CSS properties don't accept true/false as their arguments.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also note that the textProps variable doesn't seem to be filled in with anything, and we'd need to be tracking the changes to these styles, the same way we're tracking changes to the colors, so we're only writing out a new span when necessary.

htmlBuilder << ";";
htmlBuilder << "font-style:";
htmlBuilder << textProps.IsItalic();
htmlBuilder << ";";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also note that the textProps variable doesn't seem to be filled in with anything, and we'd need to be tracking the changes to these styles, the same way we're tracking changes to the colors, so we're only writing out a new span when necessary.

Comment on lines +291 to +294
bool TextAttribute::IsBold() const noexcept
{
return WI_IsFlagSet(_attrs, CharacterAttributes::Bold);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This addition is unnecessary. The "bold" state can already be determined by the IsIntense method. But in terms of what we put in the HTML output, it should probably only be triggering a bold font if the IntenseIsBold mode is also set.

@ChaseKnowlden
Copy link
Author

Not the right solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font variant ignored by copyFormatting
3 participants