Skip to content

Commit 3656272

Browse files
Update aztec/src/main/kotlin/org/wordpress/aztec/formatting/LineBlockFormatter.kt
Co-authored-by: AmandaRiu <[email protected]>
1 parent b4b1f30 commit 3656272

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/formatting/LineBlockFormatter.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,8 @@ class LineBlockFormatter(editor: AztecText) : AztecFormatter(editor) {
239239
}
240240
}
241241
if (position <= 0 && selectionEnd != 0) {
242-
position = editableText.indexOf("\n", selectionEnd)
243-
}
244-
if (position <= 0 && selectionEnd != 0) {
245-
position = editableText.length
242+
// If the text contains "\n" return that as the position, else set the position to the end of the text
243+
position = editableText.indexOf("\n", selectionEnd).takeIf { it >= 0 } ?: editableText.length
246244
}
247245
return position
248246
}

0 commit comments

Comments
 (0)