Skip to content

Commit 023454b

Browse files
authored
fix passing of literal backslash (AUTOMATIC1111#16671)
1 parent cd869bb commit 023454b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extensions-builtin/prompt-bracket-checker/javascript/prompt-bracket-checker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// If there's a mismatch, the keyword counter turns red and if you hover on it, a tooltip tells you what's wrong.
55

66
function checkBrackets(textArea, counterElt) {
7-
var counts = {};
8-
(textArea.value.match(/(?<!\\)[(){}[\]]/g) || []).forEach(bracket => {
9-
counts[bracket] = (counts[bracket] || 0) + 1;
7+
const counts = {};
8+
textArea.value.matchAll(/(?<!\\)(?:\\\\)*?([(){}[\]])/g).forEach(bracket => {
9+
counts[bracket[1]] = (counts[bracket[1]] || 0) + 1;
1010
});
11-
var errors = [];
11+
const errors = [];
1212

1313
function checkPair(open, close, kind) {
1414
if (counts[open] !== counts[close]) {

0 commit comments

Comments
 (0)