kean / Pulse

Network logger for Apple platforms
https://pulselogger.com
MIT License
6.25k stars 296 forks source link

Searching removes the backgroundColor of DecodingError highlighted text. #208

Closed wynioux closed 1 year ago

wynioux commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Fixed in https://github.com/kean/Pulse/pull/210