[PR #3535] [MERGED] Copy RTF data to the clipboard #25422

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/3535
Author: @anirudhrb
Created: 11/12/2019
Status: ✅ Merged
Merged: 11/13/2019
Merged by: @zadjii-msft

Base: master ← Head: rtf_copy


📝 Commits (4)

  • 165c5aa Copy RTF data to the clipboard
  • 667100c Added comment explaining various parts of the header
  • 3542897 Fixed static code analysis issues and added noexcept to GenRTF()
  • fd28fa5 Removed noexcept

📊 Changes

6 files changed (+210 additions, -4 deletions)

View changed files

📝 src/buffer/out/textBuffer.cpp (+183 -1)
📝 src/buffer/out/textBuffer.hpp (+5 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+7 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+9 -1)
📝 src/cascadia/TerminalControl/TermControl.h (+5 -2)
📝 src/cascadia/TerminalControl/TermControl.idl (+1 -0)

📄 Description

Summary of the Pull Request

RTF data is now copied to the clipboard. Tested by copy pasting text from terminal to WordPad.

PR Checklist

  • Closes Documentation Issue :install colorTool (#2487)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • 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: #2487

Detailed Description of the Pull Request / Additional comments

Mostly similar to PR #1224. Added a new static method GenRTF in TextBuffer that is responsible
for generating the RTF representation of a given text. The generated RTF is added to the DataPackage that is ultimately passed to the clipboard.

Validation Steps Performed

Validated by copy pasting text from the terminal to WordPad. Validated with different colors to make sure that is working. (MS Word seems to prefer HTML data from the clipboard instead of RTF.)


🔄 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/3535 **Author:** [@anirudhrb](https://github.com/anirudhrb) **Created:** 11/12/2019 **Status:** ✅ Merged **Merged:** 11/13/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `rtf_copy` --- ### 📝 Commits (4) - [`165c5aa`](https://github.com/microsoft/terminal/commit/165c5aaae80ed22c05dd207bd7348e9d7b00c335) Copy RTF data to the clipboard - [`667100c`](https://github.com/microsoft/terminal/commit/667100c9f3daeeb7aa59dbfad1ee649c0ee3d2a8) Added comment explaining various parts of the header - [`3542897`](https://github.com/microsoft/terminal/commit/354289701e836d922521c3f338c7cc226229d3ff) Fixed static code analysis issues and added noexcept to GenRTF() - [`fd28fa5`](https://github.com/microsoft/terminal/commit/fd28fa58e2693ee7df211bc3f1063e4776116471) Removed noexcept ### 📊 Changes **6 files changed** (+210 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/textBuffer.cpp` (+183 -1) 📝 `src/buffer/out/textBuffer.hpp` (+5 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+7 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+9 -1) 📝 `src/cascadia/TerminalControl/TermControl.h` (+5 -2) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request RTF data is now copied to the clipboard. Tested by copy pasting text from terminal to WordPad. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2487 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [x] 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: #2487 <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments Mostly similar to PR #1224. Added a new static method `GenRTF` in `TextBuffer` that is responsible for generating the RTF representation of a given text. The generated RTF is added to the `DataPackage` that is ultimately passed to the clipboard. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Validated by copy pasting text from the terminal to WordPad. Validated with different colors to make sure that is working. (MS Word seems to prefer HTML data from the clipboard instead of RTF.) --- <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:09:24 +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#25422