aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2025-07-18 21:43:30 +0100
committergarret <garret@airmail.cc>2025-07-18 21:43:30 +0100
commit997146248fd202cd2a3eac67c5117ee573732e4d (patch)
tree42e1f2bc48226228cfdb801060addeca09a23e53
parentb13d3d4875df832087fa59c412ed982b261f45e1 (diff)
downloadaegisub-scripts-master.tar.gz
aegisub-scripts-master.tar.bz2
aegisub-scripts-master.zip
em-dash: move cursor properly in insert modeHEADmaster
the em-dash character is 3 bytes long. previous behaviour put you in the middle of the character which could corrupt things if you continued typing so we use the actual length of the string in bytes instead
-rw-r--r--em-dash.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/em-dash.lua b/em-dash.lua
index c52aa1b..7ca18fd 100644
--- a/em-dash.lua
+++ b/em-dash.lua
@@ -1,7 +1,7 @@
script_name = "Em-dash"
script_description = "I do not have an em-dash key on my keyboard"
script_author = "garret"
-script_version = "2.1.0"
+script_version = "2.1.1"
local em = "—"
@@ -15,7 +15,7 @@ local function insert(sub, sel, act)
local start = string.sub(line.text, 1, pos - 1)
local end_ = string.sub(line.text, pos)
line.text = start .. em .. end_
- aegisub.gui.set_cursor(pos + 1)
+ aegisub.gui.set_cursor(pos + #em)
sub[act] = line
end