diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-04-23 20:27:42 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-04-23 20:27:52 +0100 |
| commit | e0f7a6f0bebe30bf57592b3fc4f9970673fd38a3 (patch) | |
| tree | 09a1644073536f632d9ed5d97caf7490aebe947b | |
| parent | d6b69cb6f7818d5fb9d01007828a385eaf1308dc (diff) | |
Remove simple_factory for highlighters
| -rw-r--r-- | src/highlighters.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc index d1159e18..1b9bdde7 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -592,6 +592,11 @@ void show_whitespaces(const Context& context, HighlightFlags flags, DisplayBuffe } } +HighlighterAndId create_show_whitespaces_highlighter(HighlighterParameters params) +{ + return {"show_whitespaces", make_simple_highlighter(show_whitespaces)}; +} + template<bool relative, bool hl_cursor_line> void show_line_numbers(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange) @@ -698,6 +703,11 @@ void show_matching_char(const Context& context, HighlightFlags flags, DisplayBuf } } +HighlighterAndId create_matching_char_highlighter(HighlighterParameters params) +{ + return {"show_matching", make_simple_highlighter(show_matching_char)}; +} + void highlight_selections(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange) { if (flags != HighlightFlags::Highlight) @@ -1222,15 +1232,6 @@ private: } }; -template<typename Func> -HighlighterFactory simple_factory(const String id, Func func) -{ - return [=](HighlighterParameters params) - { - return HighlighterAndId(id, make_simple_highlighter(func)); - }; -} - void register_highlighters() { HighlighterRegistry& registry = HighlighterRegistry::instance(); @@ -1242,11 +1243,11 @@ void register_highlighters() "Parameters: -relative, -hlcursor\n" } }); registry.append({ "show_matching", - { simple_factory("show_matching", show_matching_char), + { create_matching_char_highlighter, "Apply the MatchingChar face to the char matching the one under the cursor" } }); registry.append({ "show_whitespaces", - { simple_factory("show_whitespaces", show_whitespaces), + { create_show_whitespaces_highlighter, "Display whitespaces using symbols" } }); registry.append({ "fill", |
