Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2012-08-07 11:16:28 -0400
committerDani Megert2012-08-07 11:16:28 -0400
commita68f0663f7fb088475c19b08c09c7907db4f7a7c (patch)
tree818fa6421b10cacd456ea21cbc2001fc1f6cd1ab
parent06533d5a5344695e3851a1c885300efbf1cd2e11 (diff)
downloadeclipse.platform.text-a68f0663f7fb088475c19b08c09c7907db4f7a7c.tar.gz
eclipse.platform.text-a68f0663f7fb088475c19b08c09c7907db4f7a7c.tar.xz
eclipse.platform.text-a68f0663f7fb088475c19b08c09c7907db4f7a7c.zip
special char for non-regex search
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java15
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java6
2 files changed, 17 insertions, 4 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
index f0585cb50..8fad3f51e 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/FindReplaceDocumentAdapterTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -150,6 +150,19 @@ public class FindReplaceDocumentAdapterTest extends TestCase {
}
}
+ /**
+ * Test case for: https://bugs.eclipse.org/386751
+ */
+ public void testBug386751() {
+ FindReplaceDocumentAdapter adapter= new FindReplaceDocumentAdapter(fDocument);
+ try {
+ IRegion result= adapter.find(0, ".", true, false, true, false);
+ assertNull(result);
+ } catch (BadLocationException e) {
+ Assert.assertTrue(false);
+ }
+ }
+
public void testUTF8Pattern() {
FindReplaceDocumentAdapter findReplaceDocumentAdapter= new FindReplaceDocumentAdapter(fDocument);
try {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
index 957ff7b48..40bdd17a8 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/FindReplaceDocumentAdapter.java
@@ -166,12 +166,12 @@ public class FindReplaceDocumentAdapter implements CharSequence {
if (!caseSensitive)
patternFlags |= Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
+ if (!regExSearch)
+ findString= asRegPattern(findString);
+
if (wholeWord)
findString= "\\b" + findString + "\\b"; //$NON-NLS-1$ //$NON-NLS-2$
- if (!regExSearch && !wholeWord)
- findString= asRegPattern(findString);
-
fFindReplaceMatchOffset= startOffset;
if (fFindReplaceMatcher != null && fFindReplaceMatcher.pattern().pattern().equals(findString) && fFindReplaceMatcher.pattern().flags() == patternFlags) {
/*

Back to the top