From 5d0d8832c9632d054a998b2b78f6e937d838a2b6 Mon Sep 17 00:00:00 2001 From: 8LWXpg <105704427+8LWXpg@users.noreply.github.com> Date: Thu, 23 May 2024 12:23:42 +0800 Subject: [PATCH] fix bug on option * with B0 --- RegExHotstring.ahk | 5 +++-- demo.ahk | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RegExHotstring.ahk b/RegExHotstring.ahk index 6455413..661efff 100644 --- a/RegExHotstring.ahk +++ b/RegExHotstring.ahk @@ -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 */ @@ -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"]) { @@ -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() diff --git a/demo.ahk b/demo.ahk index c087db3..f71afd8 100644 --- a/demo.ahk +++ b/demo.ahk @@ -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