Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAnton Leherbauer2008-03-06 13:55:00 +0000
committerAnton Leherbauer2008-03-06 13:55:00 +0000
commit3ddfd62af86b9572832fd3b72448a046c0bffb9c (patch)
tree73b3e658e1c378e713fe1434fe5e16298dd44836 /core
parente10f67a94a4f5b257b048a8c3096e497184f170f (diff)
downloadorg.eclipse.cdt-3ddfd62af86b9572832fd3b72448a046c0bffb9c.tar.gz
org.eclipse.cdt-3ddfd62af86b9572832fd3b72448a046c0bffb9c.tar.xz
org.eclipse.cdt-3ddfd62af86b9572832fd3b72448a046c0bffb9c.zip
Fix mark occurrences on outdated offset while editing
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java12
2 files changed, 8 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
index 516cc7e2d32..c3da7593e47 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/MarkOccurrenceTest.java
@@ -356,6 +356,7 @@ public class MarkOccurrenceTest extends BaseUITestCase {
}
assertNotNull(fMatch);
+ fMatch= new Region(fMatch.getOffset(), fMatch.getLength() - 1);
fEditor.selectAndReveal(fMatch.getOffset(), fMatch.getLength());
assertOccurrences(2);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
index c35cf075187..1a7d4ad5600 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java
@@ -3102,9 +3102,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
if (document == null)
return;
- final IRegion wordRegion= CWordFinder.findWord(document, selection.getOffset());
- if (wordRegion == null) {
- return;
+ if (getSelectionProvider() instanceof ISelectionValidator) {
+ ISelectionValidator validator= (ISelectionValidator)getSelectionProvider();
+ if (!validator.isValid(selection)) {
+ return;
+ }
}
boolean hasChanged= false;
@@ -3117,14 +3119,14 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
if (markOccurrenceTargetRegion.getOffset() <= offset && offset <= markOccurrenceTargetRegion.getOffset() + markOccurrenceTargetRegion.getLength())
return;
}
- fMarkOccurrenceTargetRegion= wordRegion;
+ fMarkOccurrenceTargetRegion= CWordFinder.findWord(document, offset);
fMarkOccurrenceModificationStamp= currentModificationStamp;
}
OccurrenceLocation[] locations= null;
IASTNodeSelector selector= astRoot.getNodeSelector(astRoot.getFilePath());
- IASTName name= selector.findEnclosingName(wordRegion.getOffset(), wordRegion.getLength());
+ IASTName name= selector.findEnclosingName(selection.getOffset(), selection.getLength());
if (name != null) {
IBinding binding= name.resolveBinding();

Back to the top