Skip to content

Commit 9b00c29

Browse files
committed
fix for dead keys #6
1 parent 20fd4d1 commit 9b00c29

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

RegExHotstring.ahk

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
; this send level allows trigger hotstring in same script
44
SendLevel(1)
5-
RegHook := RegExHs("VI2")
5+
RegHook := RegExHk("VI2")
66
RegHook.NotifyNonText := true
77
RegHook.VisibleText := false
88
RegHook.KeyOpt("{Space}{Tab}{Enter}{NumpadEnter}{BackSpace}", "+SN")
@@ -36,14 +36,14 @@ RegExHotstring(String, CallBack, Options := "") {
3636
RegHook.Add(String, CallBack, Options)
3737
}
3838

39-
class RegExHs extends InputHook {
39+
class RegExHk extends InputHook {
4040
; stores with RegEx string as key and obj as value
4141
; "*0" option
4242
a0 := Map()
4343
; "*" option
4444
a := Map()
4545

46-
; process RegEx string and options then store in obj with properties str, call, opt
46+
; parse options and store in map
4747
class obj {
4848
__New(string, call, options) {
4949
this.call := call
@@ -68,9 +68,8 @@ class RegExHs extends InputHook {
6868
}
6969
}
7070

71-
; add new RegExHotstring
7271
Add(String, CallBack, Options) {
73-
info := RegExHs.obj(String, CallBack, Options)
72+
info := RegExHk.obj(String, CallBack, Options)
7473
if (info.opt["*"]) {
7574
try
7675
this.a0.Delete(String)
@@ -116,6 +115,13 @@ class RegExHs extends InputHook {
116115

117116
OnChar := this.char
118117
char(c) {
118+
if (StrLen(c) > 1) {
119+
this.Stop()
120+
SendText(c)
121+
this.Start()
122+
return
123+
}
124+
119125
vk := GetKeyVK(GetKeyName(c))
120126
switch vk {
121127
case 9, 13, 32:

0 commit comments

Comments
 (0)