feat(terminal): support OSC 52 to yank to system clipboard
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 14m56s
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:
+7
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user