Skip to content

Commit

Permalink
[Honorary] Make disabling honos smarter (0.2.0) (#52)
Browse files Browse the repository at this point in the history
Now instead inserts both halves separately and puts cursor in between:
    -san -> {*}_{*-san}
  • Loading branch information
petzku authored Sep 1, 2024
1 parent 1e4fec6 commit 3d74036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions DependencyControl.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,21 @@
"description": "Rightfully restore (or remove) honoraries easily by inserting autoswapper bits",
"channels": {
"stable": {
"version": "0.1.0",
"released": "2024-08-26",
"version": "0.2.0",
"released": "2024-09-01",
"default": true,
"files": [
{
"name": ".moon",
"url": "@{fileBaseUrl}@{fileName}",
"sha1": "373625e67f8d0d87ff606856afb5fa1ce646dd3b"
"sha1": "83e703f427f4736bb98e2c5222dcfe4c83e57f53"
}
]
}
},
"changelog": {
"0.1.0": ["Add DependencyControl"]
"0.1.0": ["Add DependencyControl"],
"0.2.0": ["Make disabling honos smarter"]
}
},
"petzku.JumpToNextPlus": {
Expand Down
12 changes: 6 additions & 6 deletions macros/petzku.Honorary.moon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export script_name = "Honorary"
export script_description = "Rightfully restore (or remove) honoraries easily by inserting autoswapper bits"
export script_author = "petzku"
export script_namespace = "petzku.Honorary"
export script_version = "0.1.0"
export script_version = "0.2.0"


_add_swap = (line, idx) ->
Expand All @@ -20,18 +20,18 @@ _enable = (line) ->
sel = line.text\sub ss, se-1
den = line.text\sub se
line.text = "#{beg}{*}#{sel}{*}#{den}"
-- at second {*_}
aegisub.gui.set_cursor #beg + #sel + 5
-- at second: mary{*}-tan{*_}
aegisub.gui.set_cursor #beg + #sel + 6
line

_disable = (line) ->
ss, se = aegisub.gui.get_selection!
beg = line.text\sub 1, ss-1
sel = line.text\sub ss, se-1
den = line.text\sub se
line.text = "#{beg}{**#{sel}}#{den}"
-- before swap: beg_{**sel}
aegisub.gui.set_cursor #beg
line.text = "#{beg}{*}{*#{sel}}#{den}"
-- at first: mary{*}_{*-tan}
aegisub.gui.set_cursor #beg + 4
line


Expand Down

0 comments on commit 3d74036

Please sign in to comment.