From b3deeb29b3b144e91eb4ab2c72a5e081efc2a519 Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Mon, 4 Aug 2025 04:59:33 -0700 Subject: [PATCH] fix: typing `t<` on pattern editor spams the log infinitely (#2379) The error was caused when the search for the closing delimiter extended past the last token in the sequence, which happened because the initial increments before the loop starts were not being accounted for in the loop ending condition. This was fixed by decrementing the limit of possible steps to account for the initial steps taken. --- .../source/content/text_highlighting/pattern_language.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/builtin/source/content/text_highlighting/pattern_language.cpp b/plugins/builtin/source/content/text_highlighting/pattern_language.cpp index bd288c811..b01ebe4fe 100644 --- a/plugins/builtin/source/content/text_highlighting/pattern_language.cpp +++ b/plugins/builtin/source/content/text_highlighting/pattern_language.cpp @@ -331,9 +331,11 @@ namespace hex::plugin::builtin { i32 skipCountLimit = increment > 0 ? std::min(maxSkipCount, (i32) tokenCount - 1 - tokenId) : std::min(maxSkipCount, tokenId); next(increment); + skipCountLimit -= increment; if (peek(delimiter[0])) { next(increment); + skipCountLimit -= increment; while (skipCount < skipCountLimit) { if (peek(delimiter[1])) {