[markdown] MarkdownWrappingFormattingBlock does not need a companion object

GitOrigin-RevId: c4ad915edc01284a0870e5d559787650580dd6f5
This commit is contained in:
Yuriy Artamonov
2024-09-09 21:55:57 +02:00
committed by intellij-monorepo-bot
parent d1635e67b0
commit 3829e4e8cc
2 changed files with 28 additions and 32 deletions

View File

@@ -30,14 +30,12 @@ internal class EmphasisFormattingBlock(
}
}
}
companion object {
private fun ASTNode.isLast(): Boolean {
return treeNext == null
}
private fun ASTNode.isFirstContentElement(): Boolean {
return treePrev?.hasType(MarkdownTokenTypes.EMPH) == true
}
}
}
private fun ASTNode.isLast(): Boolean {
return treeNext == null
}
private fun ASTNode.isFirstContentElement(): Boolean {
return treePrev?.hasType(MarkdownTokenTypes.EMPH) == true
}

View File

@@ -70,32 +70,30 @@ internal open class MarkdownWrappingFormattingBlock(
result.add(block)
}
}
}
companion object {
internal fun splitTextForWrapping(text: String): Sequence<TextRange> {
return sequence {
var start = -1
var length = -1
for ((index, char) in text.withIndex()) {
if (char.isWhitespace()) {
if (length > 0) {
yield(TextRange.from(start, length))
}
start = -1
length = -1
}
else {
if (start == -1) {
start = index
length = 0
}
length++
}
}
private fun splitTextForWrapping(text: String): Sequence<TextRange> {
return sequence {
var start = -1
var length = -1
for ((index, char) in text.withIndex()) {
if (char.isWhitespace()) {
if (length > 0) {
yield(TextRange.from(start, length))
}
start = -1
length = -1
}
else {
if (start == -1) {
start = index
length = 0
}
length++
}
}
if (length > 0) {
yield(TextRange.from(start, length))
}
}
}
}