/**
   * creates the style range of the StyledText for the range of the contained editor
   *
   * <p>XXX problem will occur if there is a newline in the position. Working on this! code folding.
   */
  private StyleRange[] createStyleRange(ContainedEditorManager c, Position p) {
    int offset = p.offset;
    int length = p.length;

    Rectangle rect = c.getControl().getBounds();
    int ascent = rect.height - 4;
    int descent = 4;

    // use two style ranges

    // first style range covers the entire size of the contained editor
    StyleRange first = new StyleRange();
    first.start = offset;
    first.length = Math.min(1, length);
    first.background = this.containingEditor.colorManager.getColor(new RGB(255, 255, 255));
    first.metrics =
        new GlyphMetrics(
            ascent + ContainingEditor.MARGIN,
            descent + ContainingEditor.MARGIN,
            rect.width + 2 * ContainingEditor.MARGIN);

    // this style range is hidden.  the height and width are 0
    StyleRange second = new StyleRange();
    second.start = offset + 1;
    second.length = length - 1;
    second.background = this.containingEditor.colorManager.getColor(new RGB(255, 255, 255));
    second.metrics = new GlyphMetrics(0, 0, 0);
    second.font = TINY_FONT;

    return new StyleRange[] {first, second};
  }