diff dwtx/jface/text/GapTextStore.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents a9566845f1cb
children
line wrap: on
line diff
--- a/dwtx/jface/text/GapTextStore.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/GapTextStore.d	Mon Sep 08 00:51:37 2008 +0200
@@ -60,7 +60,6 @@
 import dwtx.jface.text.IDocumentExtension4; // packageimport
 import dwtx.jface.text.IDocumentExtension2; // packageimport
 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport
-import dwtx.jface.text.Assert; // packageimport
 import dwtx.jface.text.DefaultInformationControl; // packageimport
 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport
 import dwtx.jface.text.DocumentClone; // packageimport
@@ -202,7 +201,7 @@
     private const float fSizeMultiplier;
 
     /** The store's content */
-    private char[] fContent= new char[0];
+    private char[] fContent;
     /** Starting index of the gap */
     private int fGapStart= 0;
     /** End index of the gap */
@@ -298,16 +297,16 @@
      */
     public final String get(int offset, int length) {
         if (fGapStart <= offset)
-            return new String(fContent, offset + gapSize() , length);
+            return new_String(fContent, offset + gapSize() , length);
 
         final int end= offset + length;
 
         if (end <= fGapStart)
-            return new String(fContent, offset, length);
+            return new_String(fContent, offset, length);
 
         StringBuffer buf= new StringBuffer(length);
-        buf.append(fContent, offset, fGapStart - offset);
-        buf.append(fContent, fGapEnd, end - fGapStart);
+        buf.append(fContent[ offset .. fGapStart ]);
+        buf.append(fContent[ fGapEnd .. end - fGapStart + fGapEnd ]);
         return buf.toString();
     }
 
@@ -338,7 +337,7 @@
         if (text is null) {
             adjustGap(offset, length, 0);
         } else {
-            int textLength= text.length();
+            int textLength= text.length;
             adjustGap(offset, length, textLength);
             if (textLength !is 0)
                 text.getChars(0, textLength, fContent, offset);
@@ -361,7 +360,7 @@
         final bool reuseArray= 0 <= newGapSize && newGapSize <= fThreshold;
 
         final int newGapStart= offset + add;
-        final int newGapEnd;
+        int newGapEnd;
 
         if (reuseArray)
             newGapEnd= moveGap(offset, remove, oldGapSize, newGapSize, newGapStart);
@@ -512,7 +511,7 @@
      * @return a copy of the content of this text store
      */
     protected String getContentAsString() {
-        return new String(fContent);
+        return new_String(fContent);
     }
 
     /**