Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 514934 - CodeEdit: Support special characters in editor's regex s…
…earch.
  • Loading branch information
libing wang committed Apr 24, 2017
1 parent 7a3f43d commit 3d1a7d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions bundles/org.eclipse.orion.client.core/web/orion/regex.js
Expand Up @@ -26,6 +26,7 @@ define("orion/regex", [], function() { //$NON-NLS-0$
*/
function escape(str) {
return str.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g, "\\$&"); //$NON-NLS-0$
//return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}

/**
Expand Down
Expand Up @@ -492,6 +492,12 @@ define("orion/editor/find", [ //$NON-NLS-0$
}
this._savedOptions.push(this.getOptions());
this.setOptions(tempOptions);
if(tempOptions.findString && this._regex) {
tempOptions.findString = mRegex.escape(tempOptions.findString);
tempOptions.findString = tempOptions.findString.split("\n").join("\\n");
tempOptions.findString = tempOptions.findString.split("\r").join("\\r");
tempOptions.findString = tempOptions.findString.split("\t").join("\\t");
}
}
this._startOffset = this._editor.getSelection().start;
this._editor.getTextView().addEventListener("Focus", this._listeners.onEditorFocus); //$NON-NLS-0$
Expand Down

0 comments on commit 3d1a7d9

Please sign in to comment.