matrix-org / matrix-rich-text-editor

Matrix Rich Text Editor
https://matrix-org.github.io/matrix-rich-text-editor/
Apache License 2.0
82 stars 19 forks source link

Android: fix composition issues with Compose #955

Closed jmartinesp closed 3 months ago

jmartinesp commented 3 months ago

Only re-render the contents when it's really necessary. And even when it's needed, try to restore the composing region.

This code caused an issue of missing composing regions (and incorrect input because of this) when embedding the editor in compose code that isn't present when using it with legacy Android views.

It should also improve performance as we won't be re-rendering the text for every change to it.

I added some changes to keep the Trime keyboard working while fixing a new discovered issue when backspacing in SwiftKey after https://github.com/matrix-org/matrix-rich-text-editor/pull/949 was merged.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 87.13%. Comparing base (a1942c7) to head (b503482).

Files Patch % Lines
.../java/io/element/android/wysiwyg/EditorEditText.kt 80.00% 1 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #955 +/- ## ============================================ + Coverage 86.23% 87.13% +0.89% - Complexity 441 452 +11 ============================================ Files 168 136 -32 Lines 19293 17733 -1560 Branches 1077 450 -627 ============================================ - Hits 16637 15451 -1186 + Misses 2329 1982 -347 + Partials 327 300 -27 ``` | [Flag](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | Coverage Δ | | |---|---|---| | [uitests](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `64.36% <81.25%> (+0.07%)` | :arrow_up: | | [uitests-android](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `64.36% <81.25%> (+0.07%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `86.44% <0.00%> (+0.89%)` | :arrow_up: | | [unittests-android](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `42.12% <0.00%> (-0.04%)` | :arrow_down: | | [unittests-ios](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `?` | | | [unittests-rust](https://app.codecov.io/gh/matrix-org/matrix-rich-text-editor/pull/955/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `89.64% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud