matrix-org / matrix-rich-text-editor

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

[iOS] Fix the position of the caret #882

Closed nimau closed 10 months ago

nimau commented 10 months ago

This PR fixes https://github.com/vector-im/element-x-ios/issues/1674

The caret position was calculated using the glyph bounding rectangle, but this rectangle sometimes (almost always when the caret is set at the end of a wrapped line) coincided with the start of the next line. So the final caret position was at the correct x position, but at the wrong y position.

The fix is to let the UITextView calculate the correct caret rect and just update it's y and height.

sonarcloud[bot] commented 10 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

ara4n commented 10 months ago

when will this turn up in EXI? am still getting weird caret positioning in today's nightly:

![image](https://github.com/matrix-org/matrix-rich-text-editor/assets/1294269/3c2822ca-b654-46af-b817-e5cd78ca2877

(there is no trailing space here...)

nimau commented 10 months ago

when will this turn up in EXI? am still getting weird caret positioning in today's nightly:

![image](https://github.com/matrix-org/matrix-rich-text-editor/assets/1294269/3c2822ca-b654-46af-b817-e5cd78ca2877

(there is no trailing space here...)

I'll make a version 2.19.0 to include this fix in EX.

ara4n commented 10 months ago

thanks!