Skip to content

Commit 2870a70

Browse files
authored
Reinstate the (apparently) load-bearing empty bracketed paste (#20037)
Some applications have come to rely on an "empty" bracketed paste packet to indicate that the clipboard was _requested,_ but not sent. Some agentic CLI tools use this to guess whether the clipboard contained e.g. an image or otherwise unserializable data. Apparently, gnome-terminal and VS Code do this; others as well (I tested xterm, konsole, gnome-terminal and I can't remember which ones did and which ones did not.) Refs #19517
1 parent ec939aa commit 2870a70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2972,7 +2972,11 @@ namespace winrt::TerminalApp::implementation
29722972
text = winrt::hstring{ Utils::TrimPaste(text) };
29732973
}
29742974

2975-
if (text.empty())
2975+
// LOAD BEARING: Send an empty bracketed paste even if the clipboard was empty.
2976+
// Bracketed Paste provides an application a way to know whether the
2977+
// user pasted, even if there was no applicable content on it. This
2978+
// behavior is observed in GNOME Terminal, among others.
2979+
if (!bracketedPaste && text.empty())
29762980
{
29772981
co_return;
29782982
}

0 commit comments

Comments
 (0)