addhl supports a -group option

-group <group_id> can be used to add the highlighter in a
highlighter group which will be then handled as a whole.
This commit is contained in:
Maxime Coste 2012-01-15 13:47:12 +00:00
parent 98f937146a
commit f3e8498a58

View File

@ -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)
{