| 667 | } |
| 668 | |
| 669 | void InsertHighlight(std::vector<Highlight>& highlights, const Highlight& highlight) |
| 670 | { |
| 671 | if (highlight.begin == highlight.end) |
| 672 | return; |
| 673 | |
| 674 | std::vector<Highlight> newHighlights; |
| 675 | newHighlights.reserve(highlights.size() + 2); |
| 676 | |
| 677 | auto it = highlights.begin(); |
| 678 | while (it != highlights.end() && it->begin < highlight.begin) |
| 679 | { |
| 680 | newHighlights.push_back(*it); |
| 681 | ++it; |
| 682 | } |
| 683 | |
| 684 | while (it != highlights.end() && it->end <= highlight.end) |
| 685 | ++it; |
| 686 | |
| 687 | newHighlights.push_back(highlight); |
| 688 | |
| 689 | while (it != highlights.end()) |
| 690 | { |
| 691 | newHighlights.push_back(*it); |
| 692 | ++it; |
| 693 | } |
| 694 | |
| 695 | highlights.swap(newHighlights); |
| 696 | } |
| 697 | |
| 698 | void InsertHighlight(std::vector<Highlight>& highlights, const std::string& text, const std::string& match, TextColor color) |
| 699 | { |
no test coverage detected