aboutsummaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2022-10-28 00:29:19 +0100
committergarret <garret@airmail.cc>2022-10-28 03:35:44 +0100
commit165165e750375e2b5339e9caa06bafd4dea5f3b4 (patch)
treecd168a05e22656d0de20f9dd053c6e86da733e10 /macros
parent583bb67b54a88c514c2e9ac841616318e49e24c8 (diff)
downloadaegisub-scripts-165165e750375e2b5339e9caa06bafd4dea5f3b4.tar.gz
aegisub-scripts-165165e750375e2b5339e9caa06bafd4dea5f3b4.tar.bz2
aegisub-scripts-165165e750375e2b5339e9caa06bafd4dea5f3b4.zip
add consistency assistant
Diffstat (limited to 'macros')
-rw-r--r--macros/garret.ctrl-c-ctrl-v.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/macros/garret.ctrl-c-ctrl-v.lua b/macros/garret.ctrl-c-ctrl-v.lua
new file mode 100644
index 0000000..8a1fcb6
--- /dev/null
+++ b/macros/garret.ctrl-c-ctrl-v.lua
@@ -0,0 +1,39 @@
+script_name = "consistency assistant"
+script_description = "ctrl-c ctrl-v"
+script_version = "1.0.0"
+script_author = "garret"
+script_namespace = "garret.ctrl-c-ctrl-v"
+
+local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
+local util
+if haveDepCtrl then
+ depctrl = DependencyControl({
+ --feed="TODO",
+ })
+end
+
+local function main(sub, sel)
+ local src = {}
+ for i = 1, #sub do
+ local line = sub[i]
+ if line.class == "dialogue" then
+ if line.comment ~= true then
+ if line.effect:match("ctrl%-c") then
+ aegisub.log(5, "ctrl-c: " .. line.text .. "\n")
+ table.insert(src, line)
+ elseif line.effect:match("ctrl%-v") then
+ aegisub.log(5, "ctrl-v: " .. line.text .. "\n")
+ line.text = src[1].text
+ sub[i] = line
+ table.remove(src, 1)
+ end
+ end
+ end
+ end
+end
+
+if haveDepCtrl then
+ depctrl:registerMacro(main)
+else
+ aegisub.register_macro(script_name, script_description, main)
+end