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

CodeAttributedString manual rehighlight #71

Open
matteobart opened this issue Jul 15, 2019 · 2 comments
Open

CodeAttributedString manual rehighlight #71

matteobart opened this issue Jul 15, 2019 · 2 comments

Comments

@matteobart
Copy link

It would be nice if there would be a way to manually trigger a rehighlight from the auto-highlight feature (CodeAttributedString). Essentially, on top of the highlighting, I am using a yellow highlighter to display certain text (like a Find feature). However, the only way to remove this highlighting is when a user start typing, so that it re-highlights the text.

If anyone knows a simple work around that would be great.
Calling processEditing causes an error because no edits were actually made
I tried to reset the theme (setting it to itself), but to no luck

@sirachlotz
Copy link

Possible workaround:
textStorage.invalidateAttributes(in: NSMakeRange(0, textStorage.length))
where textStorage is your CodeAttributedString.

You can obviously change the range for increased performance.
Hope that helps!

@codeshif
Copy link

Possible workaround:
textStorage.invalidateAttributes(in: NSMakeRange(0, textStorage.length))
where textStorage is your CodeAttributedString.

You can obviously change the range for increased performance.
Hope that helps!

Cannot work.

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

3 participants