feat(terminal): support OSC 52 to yank to system clipboard
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 14m56s

Helper function for `App` which writes the necessary escape sequence
directly to yank the provided string.
This commit is contained in:
2026-06-14 20:36:53 +02:00
parent 7675a3742d
commit 7500c0aa83
3 changed files with 24 additions and 1 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
const QuitText = struct {
const text = "Press ctrl+c to quit. Press ctrl+n to launch `vim`.";
const text = "Press ctrl+c to quit. Press ctrl+n to launch `vim`. Press space to yank to system clipboard.";
pub fn element(this: *@This()) App.Element {
return .{ .ptr = this, .vtable = &.{ .content = content } };
@@ -150,6 +150,12 @@ pub fn main(init: std.process.Init) !void {
.key => |key| {
if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) try app.quit();
if (key.eql(.{ .cp = zterm.input.Space })) try app.yankToSystemClipboard(
w,
gpa,
"This is a test of the OSC52 support:\n\tWith multiple lines and some special characters $?/-[]().╭─╮",
);
if (key.eql(.{ .cp = 'n', .mod = .{ .ctrl = true } })) {
try app.stop(w);
try w.flush();