-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2063,6 +2063,7 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows, | |
auto hasWrittenAnyText = false; | ||
std::optional<COLORREF> fgColor = std::nullopt; | ||
std::optional<COLORREF> bkColor = std::nullopt; | ||
TextAttribute textProps; | ||
for (size_t row = 0; row < rows.text.size(); row++) | ||
{ | ||
size_t startOffset = 0; | ||
|
@@ -2137,6 +2138,15 @@ std::string TextBuffer::GenHTML(const TextAndColor& rows, | |
htmlBuilder << "background-color:"; | ||
htmlBuilder << Utils::ColorToHexString(bkColor.value()); | ||
htmlBuilder << ";"; | ||
htmlBuilder << "text-decoration:"; | ||
htmlBuilder << textProps.IsUnderlined(); | ||
htmlBuilder << ";"; | ||
htmlBuilder << "font-weight:"; | ||
htmlBuilder << textProps.IsBold(); | ||
htmlBuilder << ";"; | ||
htmlBuilder << "font-style:"; | ||
htmlBuilder << textProps.IsItalic(); | ||
htmlBuilder << ";"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note that the |
||
htmlBuilder << "\">"; | ||
} | ||
|
||
|
There was a problem hiding this comment.
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 theIntenseIsBold
mode is also set.