diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt index abaa580ef..d9fd58d37 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlighterText.kt @@ -149,13 +149,11 @@ private fun TextLayoutResult.getBoundingBoxesForRange(start: Int, end: Int): Lis if (firstLineCharRect == null) { firstLineCharRect = rect - } else if (previousRect != null) { - if (previousRect.bottom != rect.bottom || isLastRect) { - boundingBoxes.add( - firstLineCharRect.copy(right = previousRect.right) - ) - firstLineCharRect = rect - } + } else if (previousRect != null && (previousRect.bottom != rect.bottom || isLastRect)) { + boundingBoxes.add( + firstLineCharRect.copy(right = previousRect.right) + ) + firstLineCharRect = rect } previousRect = rect }