diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-12-03 22:03:10 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-12-03 22:07:23 +0000 |
| commit | 45d5dbcc8566d54251302842d13d49cfd8f81780 (patch) | |
| tree | f766dd044240e8edd58dacd24de15abb482eb2bf /src/function_group.hh | |
| parent | d5a5b1c3296ae42d77e0c632c416ea4d7b4ca55c (diff) | |
Add support for defining and referencing highlighters
* defhl <name> defines a shared highlighter
* addhl -def-group <name> adds highlighters to the defined highlighter
* addhl ref <name> add the defined highlighter to the window's ones
Diffstat (limited to 'src/function_group.hh')
| -rw-r--r-- | src/function_group.hh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/function_group.hh b/src/function_group.hh index 491debf9..7e598a94 100644 --- a/src/function_group.hh +++ b/src/function_group.hh @@ -33,15 +33,20 @@ public: m_functions.remove(id); } - FunctionGroup& get_group(const String& id) + FunctionGroup& get_group(const String& path, Codepoint path_separator = 0) { + auto sep_it = std::find(path.begin(), path.end(), path_separator); + String id(path.begin(), sep_it); auto it = m_functions.find(id); if (it == m_functions.end()) throw runtime_error("no such id: " + id); FunctionGroup* group = it->second.template target<FunctionGroup>(); if (not group) throw runtime_error("not a group: " + id); - return *group; + if (sep_it != path.end()) + return group->get_group(String(sep_it+1, path.end()), path_separator); + else + return *group; } CandidateList complete_id(const String& prefix, ByteCount cursor_pos) const |
