From fb7234544eb6e536b37d7d036ab147d029e2a978 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 6 Mar 2013 14:17:28 +0100 Subject: [PATCH] HighlightersFactories takes back a Window parameter --- src/commands.cc | 2 +- src/highlighter.hh | 3 ++- src/highlighters.cc | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index fc315fd3..f83931e4 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -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) diff --git a/src/highlighter.hh b/src/highlighter.hh index 29992c99..615680a5 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -23,7 +23,8 @@ typedef std::function HighlighterFunc; typedef std::pair HighlighterAndId; typedef memoryview HighlighterParameters; -using HighlighterFactory = std::function; +using HighlighterFactory = std::function; struct HighlighterRegistry : FunctionRegistry, Singleton diff --git a/src/highlighters.cc b/src/highlighters.cc index 3afd50ce..49ce0a0c 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -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");