Font variant ignored by copyFormatting #20693

Closed
opened 2026-01-31 07:21:25 +00:00 by claunia · 2 comments
Owner

Originally created by @champignoom on GitHub (Oct 18, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

Add copyFormatting: "html" to config,
open a markdown document in neovim, type *asdf* **asdf** <u>asfd</u>
image
Then copy it to MS word.

Expected Behavior

Italic, bold and underline should be preserved.

Actual Behavior

The variants are ignored.

image

Originally created by @champignoom on GitHub (Oct 18, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.19045.0 ### Other Software _No response_ ### Steps to reproduce Add `copyFormatting: "html"` to config, open a markdown document in neovim, type `*asdf* **asdf** <u>asfd</u>` ![image](https://github.com/microsoft/terminal/assets/66909116/a0deae88-9e5c-4d0f-a756-1bd077cdf3db) Then copy it to MS word. ### Expected Behavior Italic, bold and underline should be preserved. ### Actual Behavior The variants are ignored. ![image](https://github.com/microsoft/terminal/assets/66909116/a9aa545c-0b6b-4604-aed5-489f3380b332)
Author
Owner

@zadjii-msft commented on GitHub (Oct 18, 2023):

That probably makes sense. I think GenHTML predates our support for bold and italic. Good find!

Note

Walkthrough

Just about here is where we'd need to fix this:
1745857407/src/buffer/out/textBuffer.cpp (L2124-L2141)

That'll need to account for other TextAttributes too, beyond just color.

@zadjii-msft commented on GitHub (Oct 18, 2023): That probably makes sense. I think GenHTML predates our support for bold and italic. Good find! > **Note** > ## Walkthrough Just about here is where we'd need to fix this: https://github.com/microsoft/terminal/blob/174585740759f3e473c5a4efe3207a20d2c78511/src/buffer/out/textBuffer.cpp#L2124-L2141 That'll need to account for other [`TextAttribute`](https://github.com/microsoft/terminal/blob/main/src/buffer/out/TextAttribute.hpp)s too, beyond just color.
Author
Owner

@tusharsnx commented on GitHub (Oct 28, 2023):

We should really be using all useful TextAttributes during formatted copy. Do note that some clients (that receives) formatting information might ignore unsupported properties.

1745857407/src/buffer/out/textBuffer.cpp (L2015-L2018)

Instead of TextAndColor, we can send the current TextAttributes and properties can be read directly from it.

Italic, bold and underline should be preserved.

I tried this for underlines, and already has something that works. Two problems though:

  • Couldn't find clients that would actually use those CSS underline properties (color/style). So, they're getting ignored anyway.
  • Doesn't make sense to do it only for underlines. All (useful) TextAttributes should be read and copied. (TextAtributes properties that cannot be represented in HTML can be ignored.)
@tusharsnx commented on GitHub (Oct 28, 2023): We should really be using all useful TextAttributes during formatted copy. Do note that some clients (that receives) formatting information might ignore unsupported properties. https://github.com/microsoft/terminal/blob/174585740759f3e473c5a4efe3207a20d2c78511/src/buffer/out/textBuffer.cpp#L2015-L2018 Instead of `TextAndColor`, we can send the current `TextAttributes` and properties can be read directly from it. > Italic, bold and underline should be preserved. I tried this for underlines, and already has something that works. Two problems though: - Couldn't find clients that would actually use those CSS underline properties (color/style). So, they're getting ignored anyway. - Doesn't make sense to do it only for underlines. All (useful) `TextAttributes` should be read and copied. (`TextAtributes` properties that cannot be represented in HTML can be ignored.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20693