feat(win32 gui): add direct copy to windows clipboard support

closes #100
This commit is contained in:
CJ van den Berg 2025-01-05 21:53:29 +01:00
parent ff04602d1c
commit 7cbd63accd
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 40 additions and 11 deletions

View file

@ -2163,7 +2163,12 @@ pub const Editor = struct {
if (self.clipboard) |old|
self.allocator.free(old);
self.clipboard = text;
tui.current().rdr.copy_to_system_clipboard(text);
if (builtin.os.tag == .windows) {
@import("renderer").copy_to_windows_clipboard(text) catch |e|
self.logger.print_err("clipboard", "failed to set clipboard: {any}", .{e});
} else {
tui.current().rdr.copy_to_system_clipboard(text);
}
}
fn copy_selection(root: Buffer.Root, sel: Selection, text_allocator: Allocator, metrics: Buffer.Metrics) ![]u8 {