consistency assistant: add named captures
This commit is contained in:
parent
165165e750
commit
b969522dc8
|
@ -1,6 +1,6 @@
|
||||||
script_name = "consistency assistant"
|
script_name = "consistency assistant"
|
||||||
script_description = "ctrl-c ctrl-v"
|
script_description = "ctrl-c ctrl-v"
|
||||||
script_version = "1.0.0"
|
script_version = "1.1.0"
|
||||||
script_author = "garret"
|
script_author = "garret"
|
||||||
script_namespace = "garret.ctrl-c-ctrl-v"
|
script_namespace = "garret.ctrl-c-ctrl-v"
|
||||||
|
|
||||||
|
@ -18,14 +18,17 @@ local function main(sub, sel)
|
||||||
local line = sub[i]
|
local line = sub[i]
|
||||||
if line.class == "dialogue" then
|
if line.class == "dialogue" then
|
||||||
if line.comment ~= true then
|
if line.comment ~= true then
|
||||||
if line.effect:match("ctrl%-c") then
|
local copy_name = line.effect:match("ctrl%-c ?([%S]*)")
|
||||||
aegisub.log(5, "ctrl-c: " .. line.text .. "\n")
|
local paste_name = line.effect:match("ctrl%-v ?([%S]*)")
|
||||||
table.insert(src, line)
|
if copy_name ~= nil then
|
||||||
elseif line.effect:match("ctrl%-v") then
|
aegisub.log(5, "ctrl-c " .. copy_name .. ": " .. line.text .. "\n")
|
||||||
aegisub.log(5, "ctrl-v: " .. line.text .. "\n")
|
src[copy_name] = src[copy_name] or {}
|
||||||
line.text = src[1].text
|
table.insert(src[copy_name], line)
|
||||||
|
elseif paste_name ~= nil then
|
||||||
|
aegisub.log(5, "ctrl-v " .. paste_name .. ": " .. line.text .. "\n")
|
||||||
|
line.text = src[paste_name][1].text
|
||||||
sub[i] = line
|
sub[i] = line
|
||||||
table.remove(src, 1)
|
table.remove(src[paste_name], 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue