Remove simple_factory for highlighters
This commit is contained in:
parent
d6b69cb6f7
commit
e0f7a6f0be
|
@ -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>
|
template<bool relative, bool hl_cursor_line>
|
||||||
void show_line_numbers(const Context& context, HighlightFlags flags,
|
void show_line_numbers(const Context& context, HighlightFlags flags,
|
||||||
DisplayBuffer& display_buffer, BufferRange)
|
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)
|
void highlight_selections(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange)
|
||||||
{
|
{
|
||||||
if (flags != HighlightFlags::Highlight)
|
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()
|
void register_highlighters()
|
||||||
{
|
{
|
||||||
HighlighterRegistry& registry = HighlighterRegistry::instance();
|
HighlighterRegistry& registry = HighlighterRegistry::instance();
|
||||||
|
@ -1242,11 +1243,11 @@ void register_highlighters()
|
||||||
"Parameters: -relative, -hlcursor\n" } });
|
"Parameters: -relative, -hlcursor\n" } });
|
||||||
registry.append({
|
registry.append({
|
||||||
"show_matching",
|
"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" } });
|
"Apply the MatchingChar face to the char matching the one under the cursor" } });
|
||||||
registry.append({
|
registry.append({
|
||||||
"show_whitespaces",
|
"show_whitespaces",
|
||||||
{ simple_factory("show_whitespaces", show_whitespaces),
|
{ create_show_whitespaces_highlighter,
|
||||||
"Display whitespaces using symbols" } });
|
"Display whitespaces using symbols" } });
|
||||||
registry.append({
|
registry.append({
|
||||||
"fill",
|
"fill",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user