Acclorite / book-story

Material3 eBook reader - Book's Story. Built with Jetpack Compose. Free & Open Source & Ad Free. 7 supported file formats (.txt, .pdf, .epub, .fb2, .zip, .html, .htm). Lots of customization.
GNU General Public License v3.0
384 stars 19 forks source link

Text justification breaks word highlighting #65

Closed nvllz closed 2 months ago

nvllz commented 2 months ago

Describe the bug I face issues with proper word highlighting while Text alignment set to Justify. It works correctly with other alignment options.

Screenshots (optional)

https://github.com/user-attachments/assets/54be436b-2a32-4743-96f2-8724e5c0aa71

Device Info (please complete the following information):

Additional context (optional) It seems to be a visual bug as sharing to a translation app results in sharing desired word, while selection is not aligned properly.

Acclorite commented 2 months ago

Thank you for the report. Firstly, that is not device issue, just reproduced on different Android version and device.

About the bug. It seems to be internal issue with SelectionContainer, sadly I have no access to text selection, meaning I cannot really change anything. When using "Justify" text alignment, I also use internal TextAlign parameter, of course, I also do not have any control over it. Sadly, not fixable without manual intervention, which will probably result in performance issues.

From my perspective, SelectionContainer sees the text in alignment that is before "Justifying", which is plain text aligned at the start, then the text itself alignes to match "Justify" and SelectionContainer cannot recognize that.