From dd6462ed57b566ea7deeef6c727948a11f7771be Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 1 Nov 2013 19:22:34 +0000 Subject: [PATCH] regex option highlighter use runtime window rather than creation time one --- src/highlighters.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/highlighters.cc b/src/highlighters.cc index f0f54631..8880088f 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -161,7 +161,7 @@ public: void operator()(const Window& window, DisplayBuffer& display_buffer) { - Regex regex = m_regex_getter(); + Regex regex = m_regex_getter(window); if (regex != m_last_regex) { m_last_regex = regex; @@ -186,7 +186,7 @@ HighlighterAndId highlight_search_factory(HighlighterParameters params, const Wi try { ColorSpec colors { { 0, &get_color(params[0]) } }; - auto get_regex = []{ + auto get_regex = [](const Window&){ auto s = RegisterManager::instance()['/'].values(Context{}); return s.empty() ? Regex{} : Regex{s[0].begin(), s[0].end()}; }; @@ -198,18 +198,17 @@ HighlighterAndId highlight_search_factory(HighlighterParameters params, const Wi } } -HighlighterAndId highlight_regex_option_factory(HighlighterParameters params, const Window& window) +HighlighterAndId highlight_regex_option_factory(HighlighterParameters params, const Window&) { if (params.size() != 2) throw runtime_error("wrong parameter count"); ColorSpec colors { { 0, &get_color(params[1]) } }; String option_name = params[0]; - const OptionManager& options = window.options(); // verify option type now - options[option_name].get(); + GlobalOptions::instance()[option_name].get(); - auto get_regex = [option_name, &options]{ return options[option_name].get(); }; + auto get_regex = [option_name](const Window& window){ return window.options()[option_name].get(); }; return {"hloption_" + option_name, DynamicRegexHighlighter{colors, get_regex}}; }