Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wkal-pubnub committed Sep 2, 2024
1 parent 8c2de48 commit 5f1864a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MessageDraftImpl(

// clean up mentions that no longer start with a @ or #, or are empty strings
mentions.removeIf { mention ->
if (mention.length == 0) {
if (mention.length == 0 + (mention.startChar?.let { 1 } ?: 0)) {
true
} else {
when (mention) {
Expand Down Expand Up @@ -141,7 +141,7 @@ class MessageDraftImpl(
messageText.delete(offset, offset + length)
mentions.forEach { mention ->
val removalEnd = offset + length
if (!(offset > mention.endExclusive || removalEnd < mention.start)) {
if (offset <= mention.endExclusive && removalEnd >= mention.start) {
val intersectStart = max(offset, mention.start)
val intersectEnd = min(removalEnd, mention.endExclusive)
val intersectLen = intersectEnd - intersectStart
Expand Down

0 comments on commit 5f1864a

Please sign in to comment.