override fun rewrite()

in core/src/main/java/com/facebook/ktfmt/kdoc/KDocCommentsHelper.kt [35:55]


  override fun rewrite(tok: Tok, maxWidth: Int, column0: Int): String {
    if (!tok.isComment) {
      return tok.originalText
    }
    var text = tok.originalText
    if (tok.isJavadocComment) {
      text = KDocFormatter.formatKDoc(text, column0, maxLineLength)
    }
    val lines = ArrayList<String>()
    val it = Newlines.lineIterator(text)
    while (it.hasNext()) {
      lines.add(CharMatcher.whitespace().trimTrailingFrom(it.next()))
    }
    return if (tok.isSlashSlashComment) {
      indentLineComments(lines, column0)
    } else if (javadocShaped(lines)) {
      indentJavadoc(lines, column0)
    } else {
      preserveIndentation(lines, column0)
    }
  }