1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-11 01:37:41 +03:00

Do not pass a window to highlighters factories

This commit is contained in:
Maxime Coste 2013-11-18 23:19:48 +00:00
parent a9d832965f
commit d880465f38
3 changed files with 8 additions and 10 deletions

View File

@ -267,8 +267,7 @@ void add_highlighter(CommandParameters params, Context& context)
get_group(window.highlighters(), parser.option_value("group"))
: window.highlighters();
auto& factory = registry[name];
group.append(factory(highlighter_params, window));
group.append(registry[name](highlighter_params));
}
void rm_highlighter(CommandParameters params, Context& context)

View File

@ -24,8 +24,7 @@ typedef std::function<void (const Window& window, DisplayBuffer& display_buffer)
typedef std::pair<String, HighlighterFunc> HighlighterAndId;
typedef memoryview<String> HighlighterParameters;
using HighlighterFactory = std::function<HighlighterAndId (HighlighterParameters params,
Window& window)>;
using HighlighterFactory = std::function<HighlighterAndId (HighlighterParameters params)>;
using HighlighterGroup = FunctionGroup<const Window&, DisplayBuffer&>;

View File

@ -128,7 +128,7 @@ private:
}
};
HighlighterAndId colorize_regex_factory(HighlighterParameters params, const Window&)
HighlighterAndId colorize_regex_factory(HighlighterParameters params)
{
if (params.size() < 2)
throw runtime_error("wrong parameter count");
@ -190,7 +190,7 @@ private:
RegexGetter m_regex_getter;
};
HighlighterAndId highlight_search_factory(HighlighterParameters params, const Window&)
HighlighterAndId highlight_search_factory(HighlighterParameters params)
{
if (params.size() != 1)
throw runtime_error("wrong parameter count");
@ -209,7 +209,7 @@ HighlighterAndId highlight_search_factory(HighlighterParameters params, const Wi
}
}
HighlighterAndId highlight_regex_option_factory(HighlighterParameters params, const Window&)
HighlighterAndId highlight_regex_option_factory(HighlighterParameters params)
{
if (params.size() != 2)
throw runtime_error("wrong parameter count");
@ -345,7 +345,7 @@ void expand_unprintable(const Window& window, DisplayBuffer& display_buffer)
}
}
HighlighterAndId flag_lines_factory(HighlighterParameters params, Window& window)
HighlighterAndId flag_lines_factory(HighlighterParameters params)
{
if (params.size() != 2)
throw runtime_error("wrong parameter count");
@ -387,7 +387,7 @@ class SimpleHighlighterFactory
public:
SimpleHighlighterFactory(const String& id) : m_id(id) {}
HighlighterAndId operator()(HighlighterParameters params, const Window&) const
HighlighterAndId operator()(HighlighterParameters params) const
{
return HighlighterAndId(m_id, HighlighterFunc(highlighter_func));
}
@ -395,7 +395,7 @@ private:
String m_id;
};
HighlighterAndId highlighter_group_factory(HighlighterParameters params, const Window&)
HighlighterAndId highlighter_group_factory(HighlighterParameters params)
{
if (params.size() != 1)
throw runtime_error("wrong parameter count");