mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-240930 do not highlight both pairs of braces in case: )(<caret>...
IDEA-CR-62605 GitOrigin-RevId: 1d7b1f6054ee75e67cd6c0a751833a380e106640
This commit is contained in:
committed by
intellij-monorepo-bot
parent
45149087b1
commit
d998d0c2e1
+1
-1
@@ -185,7 +185,7 @@ public class BraceHighlightingHandler {
|
||||
|
||||
BraceHighlightingAndNavigationContext context = BraceMatchingUtil.computeHighlightingAndNavigationContext(myEditor, myPsiFile);
|
||||
if (context != null) {
|
||||
doHighlight(context.currentBraceOffset, false);
|
||||
doHighlight(context.currentBraceOffset, context.isCaretAfterBrace);
|
||||
offset = context.currentBraceOffset;
|
||||
}
|
||||
else if (offset > 0 && offset < chars.length()) {
|
||||
|
||||
+12
-10
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.highlighting;
|
||||
|
||||
@@ -93,30 +93,30 @@ public class BraceMatchingUtil {
|
||||
|
||||
if (editor.getSettings().isBlockCursor()) {
|
||||
if (isBeforeLeftBrace && matchBrace(text, fileType, iterator, true)) {
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart(), false);
|
||||
}
|
||||
else if (isBeforeRightBrace && matchBrace(text, fileType, iterator, false)) {
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart(), false);
|
||||
}
|
||||
else if (isAfterRightBrace && matchBrace(text, preOffsetFileType, preOffsetIterator, false)) {
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart(), true);
|
||||
}
|
||||
else if (isAfterLeftBrace && matchBrace(text, preOffsetFileType, preOffsetIterator, true)) {
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart(), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isAfterRightBrace && matchBrace(text, preOffsetFileType, preOffsetIterator, false)) {
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getStart(), true);
|
||||
}
|
||||
else if (isBeforeLeftBrace && matchBrace(text, fileType, iterator, true)) {
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getEnd());
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getEnd(), false);
|
||||
}
|
||||
else if (isAfterLeftBrace && matchBrace(text, preOffsetFileType, preOffsetIterator, true)) {
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getEnd());
|
||||
return new BraceHighlightingAndNavigationContext(preOffsetTokenStart, preOffsetIterator.getEnd(), true);
|
||||
}
|
||||
else if (isBeforeRightBrace && matchBrace(text, fileType, iterator, false)) {
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart());
|
||||
return new BraceHighlightingAndNavigationContext(offsetTokenStart, iterator.getStart(), false);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -541,10 +541,12 @@ public class BraceMatchingUtil {
|
||||
public static final class BraceHighlightingAndNavigationContext {
|
||||
public final int currentBraceOffset;
|
||||
public final int navigationOffset;
|
||||
public final boolean isCaretAfterBrace;
|
||||
|
||||
public BraceHighlightingAndNavigationContext(int currentBraceOffset, int navigationOffset) {
|
||||
public BraceHighlightingAndNavigationContext(int currentBraceOffset, int navigationOffset, boolean isCaretAfterBrace) {
|
||||
this.currentBraceOffset = currentBraceOffset;
|
||||
this.navigationOffset = navigationOffset;
|
||||
this.isCaretAfterBrace = isCaretAfterBrace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
int[ ][<caret> ];
|
||||
@@ -0,0 +1 @@
|
||||
int[ ]<brace>[<caret></brace> <brace>]</brace>;
|
||||
@@ -0,0 +1 @@
|
||||
int[ ][<caret> ];
|
||||
@@ -0,0 +1 @@
|
||||
int[ ]<brace>[<caret></brace> <brace>]</brace>;
|
||||
Reference in New Issue
Block a user