/**
     * Returns whether the MLC token containing <code>offs</code> appears to have a "nested" comment
     * (i.e., contains "<code>/*</code>" somewhere inside of it). This implies that it is likely a
     * "new" MLC and needs to be closed. While not foolproof, this is usually good enough of a sign.
     *
     * @param textArea
     * @param line
     * @param offs
     * @return Whether a comment appears to be nested inside this one.
     */
    private boolean appearsNested(RSyntaxTextArea textArea, int line, int offs) {

      final int firstLine = line; // Remember the line we start at.

      while (line < textArea.getLineCount()) {
        Token t = textArea.getTokenListForLine(line);
        int i = 0;
        // If examining the first line, start at offs.
        if (line++ == firstLine) {
          t = RSyntaxUtilities.getTokenAtOffset(t, offs);
          if (t == null) { // offs was at end of the line
            continue;
          }
          i = t.documentToToken(offs);
        } else {
          i = t.getTextOffset();
        }
        int textOffset = t.getTextOffset();
        while (i < textOffset + t.length() - 1) {
          if (t.charAt(i - textOffset) == '/' && t.charAt(i - textOffset + 1) == '*') {
            return true;
          }
          i++;
        }
        // If tokens come after this one on this line, our MLC ended.
        if (t.getNextToken() != null) {
          return false;
        }
      }

      return true; // No match - MLC goes to the end of the file
    }
 /**
  * Determines the preferred span for this view along an axis. This is implemented to provide the
  * superclass behavior after first making sure that the current font metrics are cached (for the
  * nested lines which use the metrics to determine the height of the potentially wrapped lines).
  *
  * @param axis may be either View.X_AXIS or View.Y_AXIS
  * @return the span the view would like to be rendered into. Typically the view is told to render
  *     into the span that is returned, although there is no guarantee. The parent may choose to
  *     resize or break the view.
  * @see View#getPreferredSpan
  */
 public float getPreferredSpan(int axis) {
   updateMetrics();
   float span = 0;
   if (axis == View.X_AXIS) { // Add EOL marker
     span = super.getPreferredSpan(axis);
     span += metrics.charWidth('\u00b6'); // metrics set in updateMetrics
   } else {
     span = super.getPreferredSpan(axis);
     host = (RSyntaxTextArea) getContainer();
     if (host.isCodeFoldingEnabled()) {
       // TODO: Cache y-offsets again to speed this up
       // System.out.println("y-axis baby");
       int lineCount = host.getLineCount();
       FoldManager fm = host.getFoldManager();
       for (int i = 0; i < lineCount; i++) {
         if (fm.isLineHidden(i)) {
           span -= getSpan(View.Y_AXIS, i);
         }
       }
     }
   }
   return span;
 }