Leon
03/07/2022, 7:16 PMBasicTextField that has a visual transformation applied to it that transforms # Title to Title and changes the size of the text (markdown). It constructs a TransformedText object with an OffsetMapping to account for the 2 characters that have been removed. However there seems to be a bug because when I type in # Title it gets transformed to Title in the text field however when I move the cursor using the arrow keys to the end of the line the application crashes with an out of bounds error. I traced this down and it looks like its an issue with the isLtr() function as it uses selection.end without performing a OffsetMapping conversion on it.
// TextPreparedSelection.kt
private fun isLtr(): Boolean {
val direction = layoutResult?.getParagraphDirection(selection.end)
return direction != ResolvedTextDirection.Rtl
}
Any ideas on how I could resolve this issue?mkrussel
03/07/2022, 7:24 PMoffset - charactersRemoved That caused negative values to be returned from originalToTransformedLeon
03/07/2022, 9:13 PMZach Klippenstein (he/him) [MOD]
03/08/2022, 1:11 AMLeon
03/08/2022, 1:41 AMZoltan Demant
03/08/2022, 4:40 AMLeon
03/08/2022, 1:10 PM