summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Azad2012-04-27 08:13:36 (EDT)
committerDani Megert2012-04-27 08:13:36 (EDT)
commitceab3c0e6320d35d3ac67512bbe480c3a742341a (patch)
tree58f731ac576c919a50362a119030b4e4cfeebdb9
parentcb22879bf494abef4f0249f6c7cbb839abbb3a90 (diff)
downloadeclipse.platform.text-ceab3c0e6320d35d3ac67512bbe480c3a742341a.zip
eclipse.platform.text-ceab3c0e6320d35d3ac67512bbe480c3a742341a.tar.gz
eclipse.platform.text-ceab3c0e6320d35d3ac67512bbe480c3a742341a.tar.bz2
Fixed bug 377417: [syntax highlighting] enclosing bracket highlighting
inconsistent with non-zero selection
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
index 51c9eeb..56fbc90 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java
@@ -355,8 +355,16 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher, IChar
boolean lowerFound= false;
boolean upperFound= false;
int[][] counts= new int[pairs.length][2];
- int pos1= doc.getNextPosition(start, false);
- int pos2= start;
+ char currChar= (start != document.getLength()) ? doc.getChar(start) : Character.MIN_VALUE;
+ int pos1;
+ int pos2;
+ if (fPairs.isEndCharacter(currChar)) {
+ pos1= doc.getNextPosition(start, false);
+ pos2= start;
+ } else {
+ pos1= start;
+ pos2= doc.getNextPosition(start, true);
+ }
while ((pos1 >= lowerBoundary && !lowerFound) || (pos2 < upperBoundary && !upperFound)) {
for (int i= 0; i < counts.length; i++) {
@@ -401,7 +409,7 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher, IChar
pos2= doc.getNextPosition(pos2, true);
}
- if (pos1 > start || pos2 < end) {
+ if (pos1 > start || pos2 < end - 1) {
//match inside selection => discard
pos1= doc.getNextPosition(pos1, false);
pos2= doc.getNextPosition(pos2, true);