1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

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>
This commit is contained in:
Torbjörn Svensson 2018-04-09 14:21:29 +02:00 committed by Jeff Johnston
parent fc8f2d6176
commit 864b305ff4

View file

@ -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;
}