From aeb451f9731370984725dd1eb2d226cb5f55b50a Mon Sep 17 00:00:00 2001 From: seth-js <83692925+seth-js@users.noreply.github.com> Date: Sun, 28 Apr 2024 11:25:01 -0500 Subject: [PATCH] use powershell for clipboard (#123) Switched to `powershell` to avoid text escape issues, and to remove the automatic newline. --- platform/win.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/win.lua b/platform/win.lua index 38d489c..b42ec88 100644 --- a/platform/win.lua +++ b/platform/win.lua @@ -20,8 +20,7 @@ self.tmp_dir = function() end self.copy_to_clipboard = function(text) - text = text:gsub("&", "^^^&"):gsub("[<>|]", ""):gsub("\"", '“') - mp.commandv("run", "cmd.exe", "/d", "/c", string.format("@echo off & chcp 65001 >nul & echo %s|clip", text)) + mp.commandv("run", "powershell", "-command", string.format('Set-Clipboard -Value "%s"', text:gsub('"', '`"'))) end self.curl_request = function(url, request_json, completion_fn)