feat(win32 gui): add clipboard paste support

This commit is contained in:
CJ van den Berg 2025-01-04 21:45:44 +01:00
parent 5bc3cd6a6d
commit 5ac80f0b6f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 8 additions and 9 deletions

View file

@ -570,10 +570,10 @@ const cmds = struct {
}
pub const open_previous_file_meta = .{ .description = "Open the previous file" };
pub fn system_paste(_: *Self, _: Ctx) Result {
pub fn system_paste(self: *Self, _: Ctx) Result {
if (builtin.os.tag == .windows) {
const text = try tui.current().rdr.request_windows_clipboard();
defer tui.current().rdr.allocator.free(text);
const text = try @import("renderer").request_windows_clipboard(self.allocator);
defer self.allocator.free(text);
return command.executeName("paste", command.fmt(.{text})) catch {};
}
tui.current().rdr.request_system_clipboard();