noties / Markwon

Android markdown library (no WebView)
https://noties.io/Markwon/
Apache License 2.0
2.76k stars 313 forks source link

PrecomputedFutureTextSetterCompat - replacing strings with empty string #394

Open EverydayPineapple opened 2 years ago

EverydayPineapple commented 2 years ago
  1. Please specify expected/actual behavior
    • Set text using PrecomputedFutureTextSetterCompat on a TextView that doesn't have a MovementMethod applied yet.
    • The CorePlugin afterSetText function then tries to set a LinkMovementMethod as a suitable default.
    • InternallyTextView calls setText when setting the MovementMethod

Only sometimes, but it's fairly consistent in a few of the views in my app, the combination of future text setting and setting text whilst setting the MovementMethod means my text is set to the markdown I set, but then back to an empty String. I can see this by setting a TextWatcher on the view and logging text changes.

  1. Please specify conditions/steps to reproduce (layout, code, markdown used, etc) I haven't had time to set up a dummy project with the repro steps, but the steps above describe the scenario.

I'd suggest we could move the code in CorePlugin that sets the movement method to before the text is set. This is what I've done for now in my project and it's working fine. Not sure if there are any issues doing so.