summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-01-15 13:47:12 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-01-15 13:47:12 +0000
commitf3e8498a58c1dd5f484a5de79c5d7136b0edae2d (patch)
treee3f139020137051fee719fcc50889f627eec2a5e /src
parent98f937146a282d1cafb70eda544045ae37f49cbe (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/main.cc19
1 files 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)
{