[PR #5823] [MERGED] Add support for OSC 52 (copy-to-clipboard) #26489

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5823
Author: @uzxmx
Created: 5/9/2020
Status: Merged
Merged: 6/30/2020
Merged by: @undefined

Base: masterHead: master


📝 Commits (10+)

  • e4fe3fc Add support for VT OSC copy-to-clipboard
  • 946ac27 Base64-decode OSC 52 parameter
  • 0fa22cb Fix files mode and lint errors
  • dcac598 Suppress spellcheck for test string
  • 1e462be Add comments to explain test cases
  • 559f7fc Remove unexpected class prefix
  • 644ba34 Add Base64 class
  • e8eb5ef Merge from upstream/master
  • 91a3843 Fix spellchecks and lint
  • 2c9c297 Keep consistency

📊 Changes

27 files changed (+499 additions, -4 deletions)

View changed files

📝 .github/actions/spell-check/expect/expect.txt (+1 -0)
📝 .github/actions/spell-check/patterns/patterns.txt (+4 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+11 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalCore/ITerminalApi.hpp (+2 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+5 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+4 -0)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+9 -0)
📝 src/cascadia/TerminalCore/TerminalDispatch.cpp (+7 -0)
📝 src/cascadia/TerminalCore/TerminalDispatch.hpp (+2 -0)
📝 src/terminal/adapter/ITermDispatch.hpp (+2 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+11 -0)
📝 src/terminal/adapter/adaptDispatch.hpp (+4 -2)
📝 src/terminal/adapter/termDispatch.hpp (+2 -0)
📝 src/terminal/parser/OutputStateMachineEngine.cpp (+44 -0)
📝 src/terminal/parser/OutputStateMachineEngine.hpp (+5 -0)
src/terminal/parser/base64.cpp (+186 -0)
src/terminal/parser/base64.hpp (+25 -0)
📝 src/terminal/parser/parser-common.vcxitems (+2 -0)
📝 src/terminal/parser/sources.inc (+1 -0)

...and 7 more files

📄 Description

With this commit, terminal will be able to copy text to the system
clipboard by using OSC 52 MANIPULATE SELECTION DAATA.

We chose not to implement the clipboard querying functionality offered
by OSC 52, as sending the clipboard text to an application without the
user's knowledge or consent is an immense security hole.

We do not currently support the clipboard specifier Pc to specify which
clipboard buffer should be filled

Base64 encoded foo

$ echo -en "\e]52;;Zm9v\a"

Multiple lines

Base64 encoded foo\r\nbar

$ echo -en "\e]52;;Zm9vDQpiYXI=\a"

Closes #2946.


🔄 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/5823 **Author:** [@uzxmx](https://github.com/uzxmx) **Created:** 5/9/2020 **Status:** ✅ Merged **Merged:** 6/30/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (10+) - [`e4fe3fc`](https://github.com/microsoft/terminal/commit/e4fe3fc619f181672455ce00f6a51b26b9f0369a) Add support for VT OSC copy-to-clipboard - [`946ac27`](https://github.com/microsoft/terminal/commit/946ac2725b75668780ca86d670a4cfc0cb1c18dc) Base64-decode OSC 52 parameter - [`0fa22cb`](https://github.com/microsoft/terminal/commit/0fa22cb805a279e2749cf90e0e0717c6c3dd64fe) Fix files mode and lint errors - [`dcac598`](https://github.com/microsoft/terminal/commit/dcac59839d2880723a99a7a975da8f0aac160cae) Suppress spellcheck for test string - [`1e462be`](https://github.com/microsoft/terminal/commit/1e462be546151514fe3eb40867647f7f1e70fe71) Add comments to explain test cases - [`559f7fc`](https://github.com/microsoft/terminal/commit/559f7fc88003017ef0c275ac7e569c6606119d53) Remove unexpected class prefix - [`644ba34`](https://github.com/microsoft/terminal/commit/644ba349fe153946dd6950f4fdc994739f4a2093) Add Base64 class - [`e8eb5ef`](https://github.com/microsoft/terminal/commit/e8eb5effb1caff97191a7f8861eecb2de1f9091a) Merge from upstream/master - [`91a3843`](https://github.com/microsoft/terminal/commit/91a3843fcd73388200c2b6d3a62f7a0c565fa109) Fix spellchecks and lint - [`2c9c297`](https://github.com/microsoft/terminal/commit/2c9c29709fa8ceaa3595e5e67ac68869afe571b9) Keep consistency ### 📊 Changes **27 files changed** (+499 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spell-check/expect/expect.txt` (+1 -0) 📝 `.github/actions/spell-check/patterns/patterns.txt` (+4 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+11 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalCore/ITerminalApi.hpp` (+2 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+5 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+4 -0) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+9 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatch.cpp` (+7 -0) 📝 `src/cascadia/TerminalCore/TerminalDispatch.hpp` (+2 -0) 📝 `src/terminal/adapter/ITermDispatch.hpp` (+2 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+11 -0) 📝 `src/terminal/adapter/adaptDispatch.hpp` (+4 -2) 📝 `src/terminal/adapter/termDispatch.hpp` (+2 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.cpp` (+44 -0) 📝 `src/terminal/parser/OutputStateMachineEngine.hpp` (+5 -0) ➕ `src/terminal/parser/base64.cpp` (+186 -0) ➕ `src/terminal/parser/base64.hpp` (+25 -0) 📝 `src/terminal/parser/parser-common.vcxitems` (+2 -0) 📝 `src/terminal/parser/sources.inc` (+1 -0) _...and 7 more files_ </details> ### 📄 Description With this commit, terminal will be able to copy text to the system clipboard by using OSC 52 MANIPULATE SELECTION DAATA. We chose not to implement the clipboard querying functionality offered by OSC 52, as sending the clipboard text to an application without the user's knowledge or consent is an immense security hole. We do not currently support the clipboard specifier Pc to specify which clipboard buffer should be filled # Base64 encoded `foo` $ echo -en "\e]52;;Zm9v\a" # Multiple lines # Base64 encoded `foo\r\nbar` $ echo -en "\e]52;;Zm9vDQpiYXI=\a" Closes #2946. --- <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:16:23 +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#26489