summaryrefslogtreecommitdiff
path: root/src/commands.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-02-09 22:50:10 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-02-09 22:50:10 +0000
commit87769c9b03b516053249f86355a4e503a529c659 (patch)
tree80521de80ecef7c95b40297265cb7d77941e2fa6 /src/commands.cc
parentc0e4eca982078c21f7cf4962b5b38119a888c777 (diff)
Migrate most completion to ranked match
Diffstat (limited to 'src/commands.cc')
-rw-r--r--src/commands.cc14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/commands.cc b/src/commands.cc
index fc318522..0a34cd65 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -60,18 +60,8 @@ const PerArgumentCommandCompleter filename_completer({
static CandidateList complete_buffer_name(StringView prefix, ByteCount cursor_pos)
{
- prefix = prefix.substr(0, cursor_pos);
- Vector<RankedMatch> matches;
- for (auto& buffer : BufferManager::instance())
- {
- if (RankedMatch match{buffer->display_name(), prefix})
- matches.push_back(match);
- }
- std::sort(matches.begin(), matches.end());
- CandidateList res;
- for (auto& m : matches)
- res.push_back(m.candidate().str());
- return res;
+ auto c = transformed(BufferManager::instance(), [](const SafePtr<Buffer>& b){ return b->display_name(); });
+ return complete(prefix, cursor_pos, c);
}
const PerArgumentCommandCompleter buffer_completer({