mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[markdown] MarkdownWrappingFormattingBlock does not need a companion object
GitOrigin-RevId: c4ad915edc01284a0870e5d559787650580dd6f5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d1635e67b0
commit
3829e4e8cc
@@ -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
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user