Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally bypass cache when adding styles.
Working on Textualize/textual#1587 surfaced a caching issue that is best shown by running the code below: ```py from rich.style import Style meta = {"click": "something"} s1 = Style.from_meta(meta) s2 = Style.from_meta(meta) print(s1.link_id, s2.link_id) # Different link_id. base = Style(color="red") print((base + s1).link_id) # This is the link_id of s1. print((base + s2).link_id) # This is the link_id of s1! ``` The change presented here will bypass cache when adding styles that have a link id but don't have a link attribute (if they did, so would the combined style and the call to .copy would refresh the link id either way). Simply refreshing the link id will break Textual link highlighting.
- Loading branch information