IDEA-67915 Matching brace highlighing

Don't search forward if caret is at the line end already
This commit is contained in:
Denis Zhdanov
2011-06-24 15:56:38 +04:00
parent d42ef3a864
commit 8525da6f4e
@@ -240,8 +240,8 @@ public class BraceHighlightingHandler {
// Example:
// public void test() { <caret>
// }
boolean searchForward = true;
char c = chars.charAt(offset);
boolean searchForward = c != '\n';
// Try to find matched brace backwards.
if (offset >= originalOffset || c != '\n') {
@@ -260,8 +260,8 @@ public class BraceHighlightingHandler {
// Try to find matched brace forward.
if (searchForward) {
int forwardOffset = CharArrayUtil.shiftForward(chars, c == '\n' ? offset + 1 : offset, "\t ");
if (forwardOffset > offset || c == ' ' || c == '\t' || c == '\n') {
int forwardOffset = CharArrayUtil.shiftForward(chars, offset, "\t ");
if (forwardOffset > offset || c == ' ' || c == '\t') {
iterator = getEditorHighlighter().createIterator(forwardOffset);
FileType newFileType = getFileTypeByIterator(iterator);
if (BraceMatchingUtil.isLBraceToken(iterator, chars, newFileType) ||