Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentClone.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentClone.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentClone.java
index ca3d3b4cd..84493304b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentClone.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DocumentClone.java
@@ -71,7 +71,19 @@ class DocumentClone extends AbstractDocument {
public DocumentClone(String content, String[] lineDelimiters) {
super();
setTextStore(new StringTextStore(content));
- ConfigurableLineTracker tracker= new ConfigurableLineTracker(lineDelimiters);
+
+ boolean hasDefaultDelims= lineDelimiters == null;
+ if (!hasDefaultDelims && DefaultLineTracker.DELIMITERS.length == lineDelimiters.length) {
+ hasDefaultDelims= true;
+ for (int i= 0; i < lineDelimiters.length; i++) {
+ if (DefaultLineTracker.DELIMITERS[i] != lineDelimiters[i]) {
+ hasDefaultDelims= false;
+ break;
+ }
+ }
+ }
+
+ ILineTracker tracker= hasDefaultDelims ? new DefaultLineTracker() : new ConfigurableLineTracker(lineDelimiters);
setLineTracker(tracker);
getTracker().set(content);
completeInitialization();

Back to the top