Skip to content

Commit b29c728

Browse files
committed
[matchbrackets addon] Treat and null tokes as interchangeable
Closes #6572
1 parent 5c4f7a6 commit b29c728

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

addon/edit/matchbrackets.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
3939
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
4040

41-
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
41+
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style, config);
4242
if (found == null) return null;
4343
return {from: Pos(where.line, pos), to: found && found.pos,
4444
match: found && found.ch == match.charAt(0), forward: dir > 0};
@@ -67,7 +67,8 @@
6767
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
6868
for (; pos != end; pos += dir) {
6969
var ch = line.charAt(pos);
70-
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
70+
if (re.test(ch) && (style === undefined ||
71+
(cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || "") == (style || ""))) {
7172
var match = matching[ch];
7273
if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
7374
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};

0 commit comments

Comments
 (0)