From c73915e31eaf2c549e4f4f6ec794561f00fb218a Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" <4000772+mcmonkey4eva@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:56:03 -0700 Subject: [PATCH] EditAttention: allow negatives (#476) for #474 --- src/extensions/core/editAttention.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/extensions/core/editAttention.ts b/src/extensions/core/editAttention.ts index b2ec2784c..fba6d69a7 100644 --- a/src/extensions/core/editAttention.ts +++ b/src/extensions/core/editAttention.ts @@ -21,7 +21,6 @@ app.registerExtension({ const floatWeight = parseFloat(weight) if (isNaN(floatWeight)) return weight const newWeight = floatWeight + delta - if (newWeight < 0) return '0' return String(Number(newWeight.toFixed(10))) } @@ -143,7 +142,7 @@ app.registerExtension({ // Increment the weight const weightDelta = event.key === 'ArrowUp' ? delta : -delta const updatedText = selectedText.replace( - /\((.*):(\d+(?:\.\d+)?)\)/, + /\((.*):([+-]?\d+(?:\.\d+)?)\)/, (match, text, weight) => { weight = incrementWeight(weight, weightDelta) if (weight == 1) {