summaryrefslogtreecommitdiff
path: root/src/highlighter_group.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-12-23 13:54:09 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-12-23 13:54:09 +0000
commitb6ff15aa757eb35fed5772d28e3c06b5e844a49e (patch)
treed41ebca1b4fe4591017f5310749b263047ba9345 /src/highlighter_group.cc
parent064fb81b8d38df3bc77e2211fb6bc5db84fedb97 (diff)
Unify completion from container content logic
Diffstat (limited to 'src/highlighter_group.cc')
-rw-r--r--src/highlighter_group.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/highlighter_group.cc b/src/highlighter_group.cc
index 20058708..ecaafa95 100644
--- a/src/highlighter_group.cc
+++ b/src/highlighter_group.cc
@@ -48,11 +48,12 @@ Completions HighlighterGroup::complete_child(StringView path, ByteCount cursor_p
return offset_pos(hl.complete_child(path.substr(offset), cursor_pos - offset, group), offset);
}
- auto condition = [=](const HighlighterMap::value_type& hl)
- {
- return not group or hl.second->has_children();
- };
- return { 0, 0, m_highlighters.complete_id_if(path, cursor_pos, condition) };
+ using ValueType = HighlighterMap::value_type;
+ auto c = transformed(filtered(m_highlighters,
+ [=](const ValueType& hl)
+ { return not group or hl.second->has_children(); }),
+ HighlighterMap::get_id);
+ return { 0, 0, complete(path, cursor_pos, c) };
}
}