1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 21:22:00 +03:00

HighlightersFactories takes back a Window parameter

This commit is contained in:
Maxime Coste 2013-03-06 14:17:28 +01:00
parent 558f32d2d5
commit fb7234544e
3 changed files with 7 additions and 6 deletions

View File

@ -280,7 +280,7 @@ void add_highlighter(const CommandParameters& params, Context& context)
: window.highlighters();
auto& factory = registry[name];
group.append(factory(highlighter_params));
group.append(factory(highlighter_params, window));
}
void rm_highlighter(const CommandParameters& params, Context& context)

View File

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

View File

@ -119,7 +119,7 @@ private:
}
};
HighlighterAndId colorize_regex_factory(const HighlighterParameters params)
HighlighterAndId colorize_regex_factory(const HighlighterParameters params, const Window&)
{
if (params.size() < 2)
throw runtime_error("wrong parameter count");
@ -182,7 +182,7 @@ private:
RegexColorizer m_colorizer;
};
HighlighterAndId highlight_search_factory(const HighlighterParameters params)
HighlighterAndId highlight_search_factory(const HighlighterParameters params, const Window&)
{
if (params.size() != 1)
throw runtime_error("wrong parameter count");
@ -316,7 +316,7 @@ class SimpleHighlighterFactory
public:
SimpleHighlighterFactory(const String& id) : m_id(id) {}
HighlighterAndId operator()(const HighlighterParameters& params) const
HighlighterAndId operator()(const HighlighterParameters& params, const Window&) const
{
return HighlighterAndId(m_id, HighlighterFunc(highlighter_func));
}
@ -324,7 +324,7 @@ private:
String m_id;
};
HighlighterAndId highlighter_group_factory(const HighlighterParameters& params)
HighlighterAndId highlighter_group_factory(const HighlighterParameters& params, const Window&)
{
if (params.size() != 1)
throw runtime_error("wrong parameter count");