Skip to content

Commit

Permalink
sanitize ass tags for set-clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Jan 22, 2024
1 parent bc0e172 commit 8338b57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/dialog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ mp.register_script_message('open-clipboard', function(action)
mp.commandv('script-message-to', 'menu', 'clipboard/get', mp.get_script_name())
end)

--set clipboard
-- set clipboard
mp.register_script_message('set-clipboard', function(text)
if not text then return end
local res, err = mp.command_native({ 'expand-text', text })
local value = res and res or 'error: ' .. err
local value = text:gsub('\xFD.-\xFE', '')
mp.commandv('script-message-to', 'menu', 'clipboard/set', value)
end)

0 comments on commit 8338b57

Please sign in to comment.