changeset 274:62a03a4c21c8

sync StyledText with dwt-linux
author Frank Benoit <benoit@tionex.de>
date Sun, 03 Aug 2008 23:40:57 +0200
parents 8632408a70aa
children 9c5ba1f00519
files dwt/custom/DefaultContent.d dwt/custom/StyleRange.d dwt/custom/StyledText.d dwt/custom/StyledTextContent.d dwt/custom/StyledTextDropTargetEffect.d dwt/custom/StyledTextEvent.d dwt/custom/StyledTextRenderer.d
diffstat 7 files changed, 124 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/custom/DefaultContent.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/DefaultContent.d	Sun Aug 03 23:40:57 2008 +0200
@@ -21,10 +21,10 @@
 import dwt.custom.StyledTextEvent;
 import dwt.custom.StyledTextListener;
 import dwt.custom.StyledText;
+import dwt.dwthelper.utils;
 
 static import tango.io.model.IFile;
 static import tango.text.Text;
-import dwt.dwthelper.utils;
 
 alias tango.text.Text.Text!(char) StringBuffer;
 
@@ -32,7 +32,7 @@
     private final static String LineDelimiter = tango.io.model.IFile.FileConst.NewlineString;
 
     StyledTextListener[] textListeners; // stores text listeners for event sending
-    String textStore; // stores the actual text
+    char[] textStore; // stores the actual text
     int gapStart = -1;  // the character position start of the gap
     int gapEnd = -1;    // the character position after the end of the gap
     int gapLine = -1;   // the line on which the gap exists, the gap will always be associated with one line
@@ -734,7 +734,7 @@
  * <p>
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
  * </ul>
@@ -891,4 +891,33 @@
     lineCount_ -= numOldLines;
     gapLine = getLineAtPhysicalOffset(gapStart);
 }
+
+/++
+ + DWT extension
+ +/
+int utf8AdjustOffset( int offset ){
+    if (textStore is null)
+        return offset;
+    if (offset is 0)
+        return offset;
+    if( offset >= textStore.length ){
+        return offset;
+    }
+    if (!gapExists() || (offset < gapStart)){
+        while( textStore[offset] & 0xC0 is 0x80 ){
+            offset--;
+        }
+        return offset;
+    }
+    int gapLength= gapEnd - gapStart;
+    if( offset+gapLength >= textStore.length ){
+        return offset;
+    }
+    while( textStore[offset+gapLength] & 0xC0 is 0x80 ){
+        offset--;
+    }
+    return offset;
 }
+
+
+}
--- a/dwt/custom/StyleRange.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyleRange.d	Sun Aug 03 23:40:57 2008 +0200
@@ -12,6 +12,8 @@
  *******************************************************************************/
 module dwt.custom.StyleRange;
 
+import dwt.dwthelper.utils;
+
 
 import dwt.DWT;
 import dwt.graphics.Color;
@@ -20,7 +22,6 @@
 import dwt.custom.StyleRange;
 import dwt.custom.TextChangedEvent;
 import dwt.custom.TextChangingEvent;
-import dwt.dwthelper.utils;
 
 static import tango.text.Text;
 alias tango.text.Text.Text!(char) StringBuffer;
@@ -65,6 +66,15 @@
  */
 public this() {
 }
+/++
+ + DWT extension for clone implementation
+ +/
+protected this( StyleRange other ){
+    super( other );
+    start = other.start;
+    length = other.length;
+    fontStyle = other.fontStyle;
+}
 
 /**
  * Create a new style range from an existing text style.
@@ -73,12 +83,6 @@
  *
  * @since 3.4
  */
-public this(StyleRange style) {
-    this( cast(TextStyle)style);
-    this.start = style.start;
-    this.length = style.length;
-    this.fontStyle = style.fontStyle;
-}
 public this(TextStyle style) {
     super(style);
 }
--- a/dwt/custom/StyledText.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyledText.d	Sun Aug 03 23:40:57 2008 +0200
@@ -149,7 +149,6 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class StyledText : Canvas {
-
     alias Canvas.computeSize computeSize;
 
     static const char TAB = '\t';
@@ -626,14 +625,14 @@
         if (text is null) return;
         int lastSegmentIndex = 0;
         for (int i = 0; i < 3; i++) {
-            int segmentIndex = tango.text.Util.locatePattern( text, StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
+            int segmentIndex = text.indexOf( StyledTextPrintOptions.SEPARATOR, lastSegmentIndex);
             String segment;
-            if (segmentIndex is text.length ) {
-                segment = text[ lastSegmentIndex .. $ ].dup;
+            if (segmentIndex is -1 ) {
+                segment = text.substring(lastSegmentIndex);
                 printDecorationSegment(segment, i, page, header, layout);
                 break;
             } else {
-                segment = text[ lastSegmentIndex .. segmentIndex ].dup;
+                segment = text.substring(lastSegmentIndex, segmentIndex);
                 printDecorationSegment(segment, i, page, header, layout);
                 lastSegmentIndex = segmentIndex + StyledTextPrintOptions.SEPARATOR.length;
             }
@@ -650,12 +649,12 @@
      * @param header true = print the header, false = print the footer
      */
     void printDecorationSegment(String segment, int alignment, int page, bool header, TextLayout layout) {
-        int pageIndex = tango.text.Util.locatePattern( segment, StyledTextPrintOptions.PAGE_TAG );
-        if (pageIndex !is segment.length ) {
+        int pageIndex = segment.indexOf(StyledTextPrintOptions.PAGE_TAG);
+        if (pageIndex !is -1 ) {
             int pageTagLength = StyledTextPrintOptions.PAGE_TAG.length;
-            StringBuffer buffer = new StringBuffer(segment[ 0 .. pageIndex ]);
+            StringBuffer buffer = new StringBuffer(segment.substring (0, pageIndex));
             buffer.append (page);
-            buffer.append (segment[ pageIndex + pageTagLength .. $ ]);
+            buffer.append (segment.substring(pageIndex + pageTagLength));
             segment = buffer.toString().dup;
         }
         if (segment.length > 0) {
@@ -705,7 +704,7 @@
                     printLayout.setText("");
                 }
             } else {
-                printLayout.setText( to!(String)(index) );
+                printLayout.setText(to!(String)(index));
             }
             int paintX = x - printMargin - printLayout.getBounds().width;
             printLayout.draw(gc, paintX, y);
@@ -870,26 +869,26 @@
      * @param end end offset of segment
      */
     void write(String string, int start, int end) {
-        wchar[] wstring = tango.text.convert.Utf.toString16( string[ start .. end ] );
         start = 0;
-        end = wstring.length;
-        for (int index = start; index < end; index++) {
-            wchar ch = wstring[index];
+        end = string.length;
+        int incr = 1;
+        for (int index = start; index < end; index+=incr) {
+            dchar ch = firstCodePoint( string[index .. $], incr );
             if (ch > 0xFF && WriteUnicode) {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
                 if (index > start) {
-                    write(tango.text.convert.Utf.toString(wstring[start .. index ]));
+                    write( string[start .. index ] );
                 }
                 write("\\u");
                 write( to!(String)( cast(short)ch ));
                 write(' ');                     // control word delimiter
-                start = index + 1;
+                start = index + incr;
             } else if (ch is '}' || ch is '{' || ch is '\\') {
                 // write the sub string from the last escaped character
                 // to the current one. Fixes bug 21698.
                 if (index > start) {
-                    write(tango.text.convert.Utf.toString(wstring[start .. index]));
+                    write(string[start .. index]);
                 }
                 write('\\');
                 write(cast(char)ch); // ok because one of {}\
@@ -899,7 +898,7 @@
         // write from the last escaped character to the end.
         // Fixes bug 21698.
         if (start < end) {
-            write(tango.text.convert.Utf.toString(wstring[ start .. end]));
+            write(string[ start .. end]);
         }
     }
     /**
@@ -1269,7 +1268,7 @@
         }
         int copyEnd = Math.min(lineLength, endOffset - lineOffset);
         if (lineIndex < copyEnd) {
-            write(line[lineIndex .. copyEnd]);
+            write(line.substring(lineIndex, copyEnd));
         }
     }
     /**
@@ -1603,16 +1602,13 @@
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
- * @exception IllegalArgumentException <ul>
- *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
  */
 public void append(String string) {
     checkWidget();
-    // DWT extension: allow null string
-    //if (string is null) {
-    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    //}
+    // DWT extension: allow null for zero length string
+//     if (string is null) {
+//         DWT.error(DWT.ERROR_NULL_ARGUMENT);
+//     }
     int lastChar = Math.max(getCharCount(), 0);
     replaceTextRange(lastChar, 0, string);
 }
@@ -1937,24 +1933,22 @@
     String delimiter = getLineDelimiter();
     while (i < length) {
         if (crIndex !is -1) {
-            crIndex = tango.text.Util.locate( text, DWT.CR, i);
-            if( crIndex is text.length ) crIndex = -1;
+            crIndex = text.indexOf (DWT.CR, i);
         }
         if (lfIndex !is -1) {
-            lfIndex = tango.text.Util.locate( text, DWT.LF, i);
-            if( lfIndex is text.length ) lfIndex = -1;
+            lfIndex = text.indexOf (DWT.LF, i);
         }
         if (lfIndex is -1 && crIndex is -1) {   // no more line breaks?
             break;
         } else if ((crIndex < lfIndex && crIndex !is -1) || lfIndex is -1) {
-            convertedText.append(text[i .. crIndex]);
+            convertedText.append(text.substring(i, crIndex));
             if (lfIndex is crIndex + 1) {       // CR/LF combination?
                 i = lfIndex + 1;
             } else {
                 i = crIndex + 1;
             }
         } else {                                    // LF occurs before CR!
-            convertedText.append(text[i .. lfIndex]);
+            convertedText.append(text.substring(i, lfIndex));
             i = lfIndex + 1;
         }
         if (isSingleLine()) {
@@ -1965,7 +1959,7 @@
     // copy remaining text if any and if not in single line mode or no
     // text copied thus far (because there only is one line)
     if (i < length && (!isSingleLine() || convertedText.length() is 0)) {
-        convertedText.append(text[i .. $]);
+        convertedText.append(text.substring(i));
     }
     return convertedText.toString();
 }
@@ -2077,7 +2071,7 @@
     int caretWidth = BIDI_CARET_WIDTH;
     Display display = getDisplay();
     if (leftCaretBitmap !is null) {
-        if (defaultCaret !is null && leftCaretBitmap==defaultCaret.getImage()) {
+        if (defaultCaret !is null && leftCaretBitmap==/*eq*/defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         leftCaretBitmap.dispose();
@@ -2094,7 +2088,7 @@
     gc.dispose();
 
     if (rightCaretBitmap !is null) {
-        if (defaultCaret !is null && rightCaretBitmap==defaultCaret.getImage()) {
+        if (defaultCaret !is null && rightCaretBitmap==/*eq*/defaultCaret.getImage()) {
             defaultCaret.setImage(null);
         }
         rightCaretBitmap.dispose();
@@ -2269,7 +2263,7 @@
  *
  * @param key the character typed by the user
  */
-void doContent(char key) {
+void doContent(dchar key) {
     Event event = new Event();
     event.start = selection.x;
     event.end = selection.y;
@@ -2289,11 +2283,11 @@
         // replace character at caret offset if the caret is not at the
         // end of the line
         if (event.end < lineOffset + line.length) {
-            event.end++;
-        }
-        event.text = [key];
+            event.end+=dcharToString( key ).length;
+        }
+        event.text = dcharToString( key );
     } else {
-        event.text = [key];
+        event.text = dcharToString( key );
     }
     if (event.text !is null) {
         if (textLimit > 0 && content.getCharCount() - (event.end - event.start) >= textLimit) {
@@ -2600,10 +2594,10 @@
 }
 /**
  * Returns the offset of the word at the specified offset.
- * If the current selection : from high index to low index
+ * If the current selection extends from high index to low index
  * (i.e., right to left, or caret is at left border of selection on
  * non-bidi platforms) the start offset of the word preceding the
- * selection is returned. If the current selection : from
+ * selection is returned. If the current selection extends from
  * low index to high index the end offset of the word following
  * the selection is returned.
  *
@@ -3009,6 +3003,7 @@
     int lineOffset = content.getOffsetAtLine(caretLine);
     int offsetInLine = caretOffset - lineOffset;
     caretAlignment = OFFSET_LEADING;
+
     if (offsetInLine > 0) {
         caretOffset = getClusterPrevious(caretOffset, caretLine);
         showCaret();
@@ -3364,7 +3359,7 @@
     return dragDetect_;
 }
 /**
- * Returns whether the widget : double click mouse behavior.
+ * Returns whether the widget implements double click mouse behavior.
  *
  * @return true if double clicking a word selects the word, false if double clicks
  * have the same effect as regular mouse clicks
@@ -3829,7 +3824,7 @@
  * It means this function can be used to retrieve the bottom pixel of any line.
  *
  * @return the top pixel of a given line index
- * 
+ *
  * @since 3.2
  */
 public int getLinePixel(int lineIndex) {
@@ -3856,9 +3851,9 @@
 /**
  * Returns the line index for a y, relative to the client area.
  * The line index returned is always in the range 0..lineCount - 1.
- * 
+ *
  * @param y the y-coordinate pixel
- * 
+ *
  * @return the line index for a given y-coordinate pixel
  *
  * @since 3.2
@@ -4950,10 +4945,10 @@
  */
 public void insert(String string) {
     checkWidget();
-    // DWT extension: allow null string
-    //if (string is null) {
-    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    //}
+    // DWT extension: allow null for zero length string
+//     if (string is null) {
+//         DWT.error(DWT.ERROR_NULL_ARGUMENT);
+//     }
     Point sel = getSelectionRange();
     replaceTextRange(sel.x, sel.y, string);
 }
@@ -5007,7 +5002,7 @@
     addListener(DWT.Paint, listener);
     addListener(DWT.Resize, listener);
     addListener(DWT.Traverse, listener);
-    ime.addListener(DWT.ImeComposition, new class () Listener {
+    ime.addListener(DWT.ImeComposition, new class() Listener {
         public void handleEvent(Event event) {
             switch (event.detail) {
                 case DWT.COMPOSITION_SELECTION: handleCompositionSelection(event); break;
@@ -5727,7 +5722,7 @@
         while ((index < length_) && (string[index] !is '&')) index++;
         if (++index >= length_) return string;
         if (string[index] !is '&') {
-            return string[0 .. index-1] ~ string[index .. length_];
+            return string.substring(0, index-1) ~ string.substring(index, length_);
         }
         index++;
     } while (index < length_);
@@ -5745,7 +5740,7 @@
     do {
         while (index < length_ && string[index] !is '&') index++;
         if (++index >= length_) return '\0';
-        if (string[index] !is '&') return CharacterToLower(firstCodePoint( string[index .. $ ] ));
+        if (string[index] !is '&') return CharacterFirstToLower(string[index .. $ ] );
         index++;
     } while (index < length_);
     return '\0';
@@ -6271,7 +6266,7 @@
  * Removes the specified bidirectional segment listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6279,7 +6274,7 @@
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
  * </ul>
- * 
+ *
  * @since 2.0
  */
 public void removeBidiSegmentListener(BidiSegmentListener listener) {
@@ -6309,7 +6304,7 @@
  * Removes the specified line background listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6327,7 +6322,7 @@
  * Removes the specified line style listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6345,7 +6340,7 @@
  * Removes the specified modify listener.
  *
  * @param modifyListener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6363,7 +6358,7 @@
  * Removes the specified listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6404,7 +6399,7 @@
  * Removes the specified verify listener.
  *
  * @param verifyListener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6422,7 +6417,7 @@
  * Removes the specified key verify listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6439,7 +6434,7 @@
  * Removes the specified word movement listener.
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception DWTException <ul>
  *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -6497,7 +6492,7 @@
 public void replaceStyleRanges(int start, int length, StyleRange[] ranges) {
     checkWidget();
     if (isListening(LineGetStyle)) return;
-    // DWT extension: allow null array
+    // DWT extension: allow null for zero length string
     //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     setStyleRanges(start, length, null, ranges, false);
 }
@@ -6535,10 +6530,10 @@
  */
 public void replaceTextRange(int start, int length, String text) {
     checkWidget();
-    // DWT extension: allow null string
-    //if (text is null) {
-    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    //}
+    // DWT extension: allow null for zero length string
+//     if (text is null) {
+//         DWT.error(DWT.ERROR_NULL_ARGUMENT);
+//     }
     int contentLength = getCharCount();
     int end = start + length;
     if (start > end || start < 0 || end > contentLength) {
@@ -7828,6 +7823,8 @@
  */
 void setSelection(int start, int length, bool sendEvent) {
     int end = start + length;
+    start = content.utf8AdjustOffset(start);
+    end = content.utf8AdjustOffset(end);
     if (start > end) {
         int temp = end;
         end = start;
@@ -7951,6 +7948,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li>
  *    <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 is styles.length)</li>
  *    <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li>
  *    <li>ERROR_INVALID_RANGE when a range overlaps</li>
@@ -7992,6 +7990,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  * @exception IllegalArgumentException <ul>
+ *    <li>ERROR_NULL_ARGUMENT when an element in the styles array is null</li>
  *    <li>ERROR_INVALID_RANGE when the number of ranges and style do not match (ranges.length * 2 is styles.length)</li>
  *    <li>ERROR_INVALID_RANGE when a range is outside the valid range (> getCharCount() or less than zero)</li>
  *    <li>ERROR_INVALID_RANGE when a range overlaps</li>
@@ -8127,7 +8126,7 @@
 public void setStyleRanges(StyleRange[] ranges) {
     checkWidget();
     if (isListening(LineGetStyle)) return;
-    // DWT extension: allow null array
+    // DWT extension: allow null for zero length string
     //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     setStyleRanges(0, 0, null, ranges, true);
 }
@@ -8169,10 +8168,10 @@
  */
 public void setText(String text) {
     checkWidget();
-    // DWT extension: allow null string
-    //if (text is null) {
-    //    DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    //}
+    // DWT extension: allow null for zero length string
+//     if (text is null) {
+//         DWT.error(DWT.ERROR_NULL_ARGUMENT);
+//     }
     Event event = new Event();
     event.start = 0;
     event.end = getCharCount();
--- a/dwt/custom/StyledTextContent.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyledTextContent.d	Sun Aug 03 23:40:57 2008 +0200
@@ -12,9 +12,9 @@
  *******************************************************************************/
 module dwt.custom.StyledTextContent;
 
-import dwt.custom.TextChangeListener;
 import dwt.dwthelper.utils;
 
+import dwt.custom.TextChangeListener;
 /**
  * Clients may implement the StyledTextContent interface to provide a
  * custom store for the StyledText widget content. The StyledText widget
@@ -143,7 +143,7 @@
  * <p>
  *
  * @param listener the listener which should no longer be notified
- * 
+ *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT when listener is null</li>
  * </ul>
@@ -208,4 +208,10 @@
  * @see TextChangeListener
  */
 public void setText(String text);
+
+/++
+ + DWT Extension
+ +/
+int utf8AdjustOffset( int offset );
+
 }
--- a/dwt/custom/StyledTextDropTargetEffect.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyledTextDropTargetEffect.d	Sun Aug 03 23:40:57 2008 +0200
@@ -28,7 +28,6 @@
 import dwt.custom.StyledTextContent;
 
 static import tango.core.Exception;
-import Math = tango.math.Math;
 import dwt.dwthelper.utils;
 
 /**
--- a/dwt/custom/StyledTextEvent.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyledTextEvent.d	Sun Aug 03 23:40:57 2008 +0200
@@ -18,7 +18,6 @@
 import dwt.custom.StyleRange;
 import dwt.custom.Bullet;
 import dwt.custom.StyledTextContent;
-import dwt.dwthelper.utils;
 
 /**
  *
--- a/dwt/custom/StyledTextRenderer.d	Sun Aug 03 02:21:43 2008 +0200
+++ b/dwt/custom/StyledTextRenderer.d	Sun Aug 03 23:40:57 2008 +0200
@@ -39,12 +39,12 @@
 import dwt.custom.StyledTextEvent;
 
 import dwt.dwthelper.Runnable;
+import dwt.dwthelper.utils;
 
 static import tango.text.Text;
 static import tango.text.Util;
 static import tango.text.convert.Utf;
 import tango.util.Convert;
-import dwt.dwthelper.utils;
 
 /**
  * A StyledTextRenderer renders the content of a StyledText widget.
@@ -394,6 +394,7 @@
     Color lineBackground = getLineBackground(lineIndex, null);
     StyledTextEvent event = styledText.getLineBackgroundData(lineOffset, line);
     if (event !is null && event.lineBackground !is null) lineBackground = event.lineBackground;
+
     int height = layout.getBounds().height;
     if (lineBackground !is null) {
         gc.setBackground(lineBackground);