Unverified Commit 427d6ced authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #1788 from RocketChat/support-regular-line-breaks

[IMPROVEMENT] Add support to regular line breaks (\n)
parents 8bb8198b 7730c958
...@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan ...@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan
import android.view.View import android.view.View
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.core.util.PatternsCompat import androidx.core.util.PatternsCompat
import chat.rocket.android.R
import chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor import chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor
import chat.rocket.android.emoji.EmojiParser import chat.rocket.android.emoji.EmojiParser
import chat.rocket.android.emoji.EmojiRepository import chat.rocket.android.emoji.EmojiRepository
...@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis ...@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis
import org.commonmark.node.ListItem import org.commonmark.node.ListItem
import org.commonmark.node.Node import org.commonmark.node.Node
import org.commonmark.node.OrderedList import org.commonmark.node.OrderedList
import org.commonmark.node.SoftLineBreak
import org.commonmark.node.StrongEmphasis import org.commonmark.node.StrongEmphasis
import org.commonmark.parser.Parser import org.commonmark.parser.Parser
import ru.noties.markwon.SpannableBuilder import ru.noties.markwon.SpannableBuilder
...@@ -219,6 +219,11 @@ class MessageParser @Inject constructor( ...@@ -219,6 +219,11 @@ class MessageParser @Inject constructor(
builder.append('\n') builder.append('\n')
} }
} }
override fun visit(softLineBreak: SoftLineBreak) {
super.visit(softLineBreak)
builder.append("\n")
}
} }
class LinkVisitor(private val builder: SpannableBuilder) : AbstractVisitor() { class LinkVisitor(private val builder: SpannableBuilder) : AbstractVisitor() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment