Skip to content

Commit

Permalink
fix bug on option * with B0
Browse files Browse the repository at this point in the history
  • Loading branch information
8LWXpg committed May 23, 2024
1 parent 72feede commit 5d0d883
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions RegExHotstring.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class RegExHk extends InputHook {
* Function for matching and executing
* @param map Map to search for RegEx string
* @param {String} input Input string
* @param {(*) => void} defer What to do if no match
* @param {(*) => void} defer What to do if no match or `O` is `false`
* @param {Integer} a Backspace count offset `match.Len[0] - a`
* @returns {Boolean} If match found
*/
Expand All @@ -193,6 +193,8 @@ class RegExHk extends InputHook {
if (start) {
if (opt["B"])
Send("{BS " match.Len[0] - a "}")
else
defer()
if (call is String) {
this.Stop()
if (opt["T"]) {
Expand All @@ -204,7 +206,6 @@ class RegExHk extends InputHook {
defer()
this.Start()
} else if (call is Func) {
; suppress trigger text key
this.Stop()
call(match, params*)
this.Start()
Expand Down
4 changes: 2 additions & 2 deletions demo.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
; replace with regex string
RegExHotstring("(\w+)a", "b$1", "C")
RegExHotstring("(\w)a(\w)", "$2a$1", "*")
RegExHotstring("(\d+)(\w+)", "$2$1", "OB0")
RegExHotstring("U\+([0-9A-F]{4})", "{U+$1}", "C")
RegExHotstring("<(\w+)>", "</$1>", "*OB0") ; try <div>
RegExHotstring("U\+([0-9A-F]{4})", "{U+$1}", "C") ; try U+221E ∞

; use anonymous function
RegExHotstring("a(\w)c", (match) => MsgBox("you just typed a" match[1] "c!"), "* ? B0")
Expand Down

0 comments on commit 5d0d883

Please sign in to comment.