contour icon indicating copy to clipboard operation
contour copied to clipboard

Add support for an empty Pc parameter in OSC 52

Open j4james opened this issue 5 months ago • 1 comments
trafficstars

Abstract

As discussed in #1761, one of the requirements for the proposed clipboard extension is that terminals must support an empty Pc parameter in OSC 52. Right now Contour doesn't handle that. For example, the test case below should copy Hello World to the clipboard, but it doesn't currently work:

printf "\e]52;;SGVsbG8gV29ybGQ=\e\\"

Motivation

The reason I'd like Contour to support this is because there are a number of applications that use OSC 52 in that format. Some examples include tmux, the FAR file manager, and the Joe editor.

Specification

I think all you would need to do so support this is change this line: https://github.com/contour-terminal/contour/blob/d8693a1516688803d6c86f8c46e9f63e2e7566a6/src/vtbackend/Screen.cpp#L2951

to something like this:

if (auto const splits = crispy::split(params, ';'); splits.size() == 2 && (splits[0] == "c" || splits[0] == ""))

j4james avatar Jun 08 '25 12:06 j4james