Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorbjörn Svensson2018-04-09 12:21:29 +0000
committerJeff Johnston2018-04-16 14:36:56 +0000
commit864b305ff4bec7b8389e25b27dc7f1e9b1be9320 (patch)
tree1eb18dd1b45a3fc57f88adb89d88ab71d6feb06a
parentfc8f2d6176d648a0d05c7131177e55edfbe607e0 (diff)
downloadorg.eclipse.cdt-864b305ff4bec7b8389e25b27dc7f1e9b1be9320.tar.gz
org.eclipse.cdt-864b305ff4bec7b8389e25b27dc7f1e9b1be9320.tar.xz
org.eclipse.cdt-864b305ff4bec7b8389e25b27dc7f1e9b1be9320.zip
Bug 533379 - Only add space when appropriate
Only strings starting with "operator" should be subject to the space addition. Change-Id: I690695e7c3385e0d4e64ddd4cbe470a20cf788d6 Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java
index 43e5bd8971..218d8a651c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchUtil.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Andrew Niefer (Rational Software) - initial implementation
+ * Torbjörn Svensson (STMicroelectronics) - bug #533379
*******************************************************************************/
package org.eclipse.cdt.internal.ui.search;
@@ -92,9 +93,11 @@ public class CSearchUtil {
*/
public static String adjustSearchStringForOperators(String searchStr) {
int operatorIndex = searchStr.indexOf("operator"); //$NON-NLS-1$
- int operatorCharIndex = operatorIndex + 8; // "operator" is 8 characters
- if (operatorCharIndex < searchStr.length() && isOperatorChar(searchStr.charAt(operatorCharIndex))) {
- searchStr = searchStr.substring(0, operatorCharIndex) + ' ' + searchStr.substring(operatorCharIndex);
+ if (operatorIndex >= 0) { // Only do this if string actually contains "operator"
+ int operatorCharIndex = operatorIndex + 8; // "operator" is 8 characters
+ if (operatorCharIndex < searchStr.length() && isOperatorChar(searchStr.charAt(operatorCharIndex))) {
+ searchStr = searchStr.substring(0, operatorCharIndex) + ' ' + searchStr.substring(operatorCharIndex);
+ }
}
return searchStr;
}

Back to the top