diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-05-03 19:41:37 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-05-07 16:26:14 +0100 |
| commit | fa5ae65f3a16abffc9a8cc5b71de41015dc0c2bf (patch) | |
| tree | b9d0187d28f4f90b2b422edffa0dbb0067c0f76c /src/highlighter_group.cc | |
| parent | 55631c8d8ef29f8c48d43410d487b6bfeb37c73b (diff) | |
Move passes logic to the base Highlighter class
Validate that childs of HighlighterGroup are matching its passes.
Diffstat (limited to 'src/highlighter_group.cc')
| -rw-r--r-- | src/highlighter_group.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/highlighter_group.cc b/src/highlighter_group.cc index 1d3defac..eaa8d4bc 100644 --- a/src/highlighter_group.cc +++ b/src/highlighter_group.cc @@ -5,15 +5,14 @@ namespace Kakoune { -void HighlighterGroup::highlight(const Context& context, HighlightPass pass, - DisplayBuffer& display_buffer, BufferRange range) +void HighlighterGroup::do_highlight(const Context& context, HighlightPass pass, + DisplayBuffer& display_buffer, BufferRange range) { for (auto& hl : m_highlighters) hl.value->highlight(context, pass, display_buffer, range); } -void HighlighterGroup::compute_display_setup(const Context& context, HighlightPass pass, - DisplaySetup& setup) +void HighlighterGroup::do_compute_display_setup(const Context& context, HighlightPass pass, DisplaySetup& setup) { for (auto& hl : m_highlighters) hl.value->compute_display_setup(context, pass, setup); @@ -21,6 +20,9 @@ void HighlighterGroup::compute_display_setup(const Context& context, HighlightPa void HighlighterGroup::add_child(HighlighterAndId&& hl) { + if ((hl.second->passes() & passes()) != hl.second->passes()) + throw runtime_error{"Cannot add that highlighter to this group, passes dont match"}; + hl.first = replace(hl.first, "/", "<slash>"); if (m_highlighters.contains(hl.first)) |
