Fix EmphasisAPI Leaking Layers, Fix Emphasis Drawing #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
CALayer
s when replacing flash emphases with other emphases.roundedPathForRange
to correctly handle emphases that span multiple line fragments.During the last point, I discovered that the emphasis manager doesn't correctly draw the text on emphases that span multiple line fragments. This makes sense, as right now it's just using a CATextLayer that has no knowledge of line breaks.
In the future, that text layer should be replaced by a custom layer that draws the text using knowledge of existing line fragments positions. However, I think the issues this PR fixes are too important to wait until that can be done.
Also note that that change will be critical to drag and drop, so it will absolutely be done and I have a branch somewhere with some of that work already completed.
Related Issues
Checklist
Screenshots
Screen recording showing the text layer bug mentioned above, as well as the fixed multi-fragment drawing, and the fixed leak.
Prior to this, when switching from flash to any other emphasis type, there was a good chance one of the new emphases would be kept. This was due to the emphasis manager assuming that the emphasis being flashed was kept around after the animation delay. This has been fixed in this PR.
Screen.Recording.2025-04-07.at.12.11.10.PM.mov