[PR #4190] [MERGED] Fix redundant CR in formatted text copy #25680

Open
opened 2026-01-31 09:11:06 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4190
Author: @mcpiroman
Created: 1/12/2020
Status: Merged
Merged: 1/14/2020
Merged by: @undefined

Base: masterHead: fix-formated-copy-line-breaks


📝 Commits (1)

  • 01b3e28 Fix redundant CR in formatted text copy

📊 Changes

1 file changed (+46 additions, -42 deletions)

View changed files

📝 src/buffer/out/textBuffer.cpp (+46 -42)

📄 Description

Summary of the Pull Request

When GenHTML or GenRTF encountered an empty line, they assumed that CR is the last character of the row and wrote it, even though in general CR and LF just break the line and instead of them either <BR> in HTML or \line in RTF is written. Don't know how I missed that in #2038.

Another question is whether the TextAndColor structure which these methods receive and which is generated by TextBuffer::GetTextForClipboard should really contain \r\n at the end of each row. I think it'd be cleaner if it didn't esp. that afaik these last 2 characters don't have associated valid color information.

References

PR Checklist

  • Closes Numpad shortcuts with both Ctrl and Shift don't work (#4187)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed - there aren't any related tests, right?
  • Requires documentation to be 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: #4147

Validation Steps Performed

Copied various terminal states and verified the generated HTML.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/4190 **Author:** [@mcpiroman](https://github.com/mcpiroman) **Created:** 1/12/2020 **Status:** ✅ Merged **Merged:** 1/14/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `fix-formated-copy-line-breaks` --- ### 📝 Commits (1) - [`01b3e28`](https://github.com/microsoft/terminal/commit/01b3e288284ddb81ed50aa2f756038796d506873) Fix redundant CR in formatted text copy ### 📊 Changes **1 file changed** (+46 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/textBuffer.cpp` (+46 -42) </details> ### 📄 Description ## Summary of the Pull Request When `GenHTML` or `GenRTF` encountered an empty line, they assumed that `CR` is the last character of the row and wrote it, even though in general `CR` and `LF` just break the line and instead of them either `<BR>` in HTML or `\line` in RTF is written. Don't know how I missed that in #2038. Another question is whether the `TextAndColor` structure which these methods receive and which is generated by `TextBuffer::GetTextForClipboard` should really contain `\r\n` at the end of each row. I think it'd be cleaner if it didn't esp. that afaik these last 2 characters don't have associated valid color information. ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [X] Closes #4187 * [X] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed - there aren't any related tests, right? * [ ] Requires documentation to be 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: #4147 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Copied various terminal states and verified the generated HTML. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:11:06 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25680