1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-3389 Space-level chat | Fix | Fix range for URL markup flow

This commit is contained in:
Evgenii Kozlov 2025-02-14 15:09:40 +01:00
parent d8673e0ac4
commit 4dc4cc8e2f

View file

@ -348,13 +348,15 @@ class ChatViewModel @Inject constructor(
val parsedUrls = buildList {
urlRegex.findAll(msg).forEach { match ->
val range = match.range
// Adjust the range to include the last character (inclusive end range)
val adjustedRange = range.first..range.last + 1
val url = match.value
// Check if a LINK markup already exists in the same range
if (markup.none { it.range == range && it.type == Block.Content.Text.Mark.Type.LINK }) {
if (markup.none { it.range == adjustedRange && it.type == Block.Content.Text.Mark.Type.LINK }) {
add(
Block.Content.Text.Mark(
range = range,
range = adjustedRange,
type = Block.Content.Text.Mark.Type.LINK,
param = url
)