Add bat::PrettyPrinter::clear_highlights#1920
Conversation
|
This request/bug-ticket looks very reasonable to me - thank you! However, do we really need a new public method for that? Shouldn't |
It also makes sense. Lines 242 to 248 in 7fe4fdf The line ranges are cloned into Since inputs are cleared, clearing line ranges makes sense to me. The point is that it is a breaking change in API. I avoided the breaking change but clearing the line ranges at let hls = std::mem::take(&mut self.highlighted_lines);
self.config.highlighted_lines = HighlightedLineRanges(LineRanges::from(hls)); |
Not sure I understand this correctly: wouldn't the breaking change only affect the cases where the behavior is currently broken/buggy anyway? (#1919) |
|
@rhysd Can you provide a quick update please? Are you still interested in this change? Or has the situation improved due to syntax lazy loading (see accompanying ticket)? |
|
I'm sorry for the lack of response. I forgot this PR. I'll take a look tonight. |
I'm not sure it is broken/buggy, but I agree that it is very edge case. |
|
Looks great - thank you. I like the implementation 👍 |
Fixes #1919
With this API, the code written in #1919 can be improved as follows: