From f3e8498a58c1dd5f484a5de79c5d7136b0edae2d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 15 Jan 2012 13:47:12 +0000 Subject: [PATCH] addhl supports a -group option -group can be used to add the highlighter in a highlighter group which will be then handled as a whole. --- src/main.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.cc b/src/main.cc index 6d3c726c..b3197bc6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -485,9 +485,22 @@ void add_highlighter(const CommandParameters& params, const Context& context) try { HighlighterRegistry& registry = HighlighterRegistry::instance(); - HighlighterParameters highlighter_params(params.begin()+1, params.end()); - registry.add_highlighter_to_window(*context.window, params[0], - highlighter_params); + if (params[0] == "-group") + { + if (params.size() < 3) + throw wrong_argument_count(); + + HighlighterGroup& group = context.window->get_highlighter_group(params[1]); + HighlighterParameters highlighter_params(params.begin()+3, params.end()); + registry.add_highlighter_to_group(*context.window, group, + params[2], highlighter_params); + } + else + { + HighlighterParameters highlighter_params(params.begin()+1, params.end()); + registry.add_highlighter_to_window(*context.window, params[0], + highlighter_params); + } } catch (runtime_error& err) {