From b245b39a85dc0c9ffcba96584a82c31c0407163e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 17 Sep 2012 21:02:08 +0200 Subject: [PATCH] RegexColorizer: store ColorPairs by pointer so that alias changes are taken into account --- src/highlighters.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/highlighters.cc b/src/highlighters.cc index c0cd686f..3f267d53 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -53,7 +53,7 @@ void highlight_range(DisplayBuffer& display_buffer, } } -typedef std::unordered_map> ColorSpec; +typedef std::unordered_map ColorSpec; class RegexColorizer { @@ -77,8 +77,8 @@ public: highlight_range(display_buffer, match[n].first, match[n].second, true, [&](DisplayAtom& atom) { - atom.fg_color = col_it->second.first; - atom.bg_color = col_it->second.second; + atom.fg_color = col_it->second->first; + atom.bg_color = col_it->second->second; }); } } @@ -132,8 +132,8 @@ HighlighterAndId colorize_regex_factory(Window& window, "' expected :[,]"); int capture = str_to_int(String(res[1].first, res[1].second)); - ColorPair& color = colors[capture]; - color = ColorRegistry::instance()[String(res[2].first, res[2].second)]; + const ColorPair*& color = colors[capture]; + color = &ColorRegistry::instance()[String(res[2].first, res[2].second)]; } String id = "colre'" + params[0] + "'";