[PR #11991] [MERGED] Use the correct background color when copying to clipboard #28817

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11991
Author: @j4james
Created: 12/18/2021
Status: ✅ Merged
Merged: 1/3/2022
Merged by: @undefined

Base: main ← Head: fix-clipboard-background


📝 Commits (1)

  • 0d471bc Use correct background color when copying to clipboard.

📊 Changes

2 files changed (+5 additions, -3 deletions)

View changed files

📝 src/cascadia/TerminalControl/ControlCore.cpp (+4 -2)
📝 src/interactivity/win32/Clipboard.cpp (+1 -1)

📄 Description

When copying content from the terminal to the clipboard (with
formatting), a default background color needs to be set to fill the
unused area of the pasted block. Prior to this PR, that color was not
correctly set, so the pasted content did not match what was seen on
screen.

Windows Terminal previously used the default background from the initial
color scheme, so it didn't take palette changes into account.
OpenConsole did use the active default color, but didn't take the
reverse screen mode into account, so could end up using the foreground
rather than the background color.

In both case I've changed the code to lookup the runtime colors in the
same way that renderer does, so they should now match what is seen on
screen.

Validation Steps Performed

I've manually confirmed that the background color is now correctly set
when copying from both Windows Terminal and OpenConsole.

Closes #11988


🔄 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/11991 **Author:** [@j4james](https://github.com/j4james) **Created:** 12/18/2021 **Status:** ✅ Merged **Merged:** 1/3/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `fix-clipboard-background` --- ### 📝 Commits (1) - [`0d471bc`](https://github.com/microsoft/terminal/commit/0d471bcb19687a9250671debea1ac4e1a1d7031a) Use correct background color when copying to clipboard. ### 📊 Changes **2 files changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+4 -2) 📝 `src/interactivity/win32/Clipboard.cpp` (+1 -1) </details> ### 📄 Description When copying content from the terminal to the clipboard (with formatting), a default background color needs to be set to fill the unused area of the pasted block. Prior to this PR, that color was not correctly set, so the pasted content did not match what was seen on screen. Windows Terminal previously used the default background from the initial color scheme, so it didn't take palette changes into account. OpenConsole did use the active default color, but didn't take the reverse screen mode into account, so could end up using the foreground rather than the background color. In both case I've changed the code to lookup the runtime colors in the same way that renderer does, so they should now match what is seen on screen. ## Validation Steps Performed I've manually confirmed that the background color is now correctly set when copying from both Windows Terminal and OpenConsole. Closes #11988 --- <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:30:57 +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#28817