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

Searching removes the backgroundColor of DecodingError highlighted text. #208

Closed
wynioux opened this issue Jul 24, 2023 · 3 comments
Closed

Comments

@wynioux
Copy link

wynioux commented Jul 24, 2023

I have provided screenshots below.

  1. Default

1

  1. Searching part of DecodingError highlighted text

2

  1. As you can see, the backgroundColor has been removed

3

I think this piece of code is causing the bug (it can be found in RichTextViewModel.clearMatches()), but it should be investigated.

textStorage.removeAttribute(.backgroundColor, range: range)

Potential Fix:
We can store the original backgroundColor in RichTextViewModel.SearchMatch and restore the color just like foregroundColor.

@wynioux
Copy link
Author

wynioux commented Jul 24, 2023

By the way I forgot to mention I tested it with code in Main Branch (4.0.0-beta.4) and iOS 16.4.

@kean
Copy link
Owner

kean commented Jul 24, 2023

Good catch.

We can store the original backgroundColor in RichTextViewModel.SearchMatch and restore the color just like foregroundColor.

It seems like an optimal solution.

@kean
Copy link
Owner

kean commented Aug 6, 2023

Fixed in #210

@kean kean closed this as completed Aug 6, 2023
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

2 participants