Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List line breaks should ignore the list prefix #2502

Open
4 tasks done
HamousOnWheels opened this issue Jan 7, 2025 · 8 comments
Open
4 tasks done

List line breaks should ignore the list prefix #2502

HamousOnWheels opened this issue Jan 7, 2025 · 8 comments

Comments

@HamousOnWheels
Copy link

⚠️ This issue respects the following points: ⚠️

  • This is a bug. Not a question or feature request.
  • The topic is not already reported at Issues. (I've searched it).
  • Markor is up to date. See Releases for the latest version. Updates are available from F-Droid and GitHub.
  • The bug is still present in the latest development version (git master). (Please download and try the test version of Markor, named Marder. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor settings are not touched. In case the issue is resolved there, you don't need to create a bug report. The change will be part of the next Markor update.)

Description

with wrapping turned on, long lines in a list will break at the list prefix (dash or number) if they don't have any spaces to break at. this leaves gaps in the list. this happens with for example, long links or hashes

wrap on
wrap off

i think the wrapping logic should skip the list prefix. example of how obsidian and vscode respectively do it:

obsidian
vscode

this doesn't happen in preview mode, only the editor. mainly interested in markdown, but this seems to happen with any text format

Steps to reproduce

  1. paste one or more lines , longer than the screen width, in an unordered or ordered list
  2. turn on line wrapping

Information

Android version: 11
Device: motorola moto g8 power
App Version: 2.14

Source

F-Droid

Format / File type

Not specific

Additional info / Log

-
@gsantner
Copy link
Owner

gsantner commented Jan 7, 2025

Unlikely feasible with the way how Android standard EditText component is implemented.

@harshad1
Copy link
Collaborator

harshad1 commented Jan 7, 2025

We can play around with line breaking strategy a little. https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/LineBreak.Strategy

@harshad1
Copy link
Collaborator

harshad1 commented Jan 9, 2025

I have spent a significant amount of time investigating this and I can't find a way to improve this without incurring a bad performance hit

@harshad1
Copy link
Collaborator

Setting

            android:breakStrategy="balanced" (or high_quality)
            android:hyphenationFrequency="normalFast"

Helps a lot but can

  1. cause some layout performance slowdowns according to documentation
  2. will cause broken words to have a hyphen inserted at the break (sometimes)

@harshad1
Copy link
Collaborator

@gsantner We can

  1. switch
  2. do nothing
  3. Make it an option
  4. Add a heuristic to change settings for very long files

IMO we switch and see if anyone complains :)

@gsantner
Copy link
Owner

Suggestion: There is a function named like isPerformanceDevice in AppSettings to make a certain differenciation.

Do suggest to apply the more complex rule by that condition, fixed

@harshad1
Copy link
Collaborator

ContextUtils.isDeviceGoodHardware :)

After some more testing I have decided not to make a PR with this change. The docs say that the 'simple' break strategy is used to prevent text 'jumping' as one types. This does seem to happen more with 'balanced' or 'high quality'. Overall I think appearance is less important than performance in edit mode.

I feel like I spend 50% of my Markor development / hobby time fighting with Android's TextView / EditText. So many bad decisions in it's design...

@gsantner
Copy link
Owner

gsantner commented Jan 11, 2025

Totally agree, it's just not made for many things.

However, it works good enough for majority of things :-).

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants