Rick Regan
01/25/2021, 9:39 PMText
or TextField
to display a repeating decimal, e.g., 2.(0123456789) (I am resorting to parentheses notation because to the best of knowledge, Android does not support overline, as discussed on this channel last week: https://kotlinlang.slack.com/archives/CJLTWPH7S/ ). The problem I have now is that line breaking rules will break the line after the "." (FYI it breaks up ".(" but not ".1(", for example). I’ve been trying to look for a solution but I really only found this 9-year old one for the regular UI (and it seems like overkill in any case): https://stackoverflow.com/questions/6134457/how-to-prevent-edittext-from-breaking-a-line-after-punctuation.
What I want is a line break only when the text string (in my case digits with other characters like "(", ")", "/", "+", "-", etc.) exceeds the width of the view. Essentially I just want the line breaking rules turned off. Can this be done in Compose? (I am porting a prototype of my app that uses JavaFX, which breaks lines as I desire.)Mark Murphy
01/26/2021, 12:08 AMWhat I want is a line break only when the text string (in my case digits with other characters like "(", ")", "/", "+", "-", etc.) exceeds the width of the viewThat seems to be what's happening, assuming that you are the person who wrote this SO question: https://stackoverflow.com/q/65877507/115145 What you really seem to be after is to be able to supply a custom line-break implementation, whereby certain characters are treated as if they were digits. I suspect that the actual text rendering is being done by the platform (e.g., Android, Windows) not by Compose. In the case of Android, it looks like they are delegating to
BoringLayout
and `StaticLayout`: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:text/tex[…]ext/android/TextLayout.ktRick Regan
01/26/2021, 1:51 AMSiyamed
01/26/2021, 5:46 AMSiyamed
01/26/2021, 5:47 AMSiyamed
01/26/2021, 5:49 AMRick Regan
01/26/2021, 1:34 PMRick Regan
01/26/2021, 1:35 PMRick Regan
01/26/2021, 1:35 PMRick Regan
01/26/2021, 9:53 PMSiyamed
01/26/2021, 9:53 PMRick Regan
01/27/2021, 9:50 PM