diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-02-09 22:50:10 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-02-09 22:50:10 +0000 |
| commit | 87769c9b03b516053249f86355a4e503a529c659 (patch) | |
| tree | 80521de80ecef7c95b40297265cb7d77941e2fa6 /src/commands.cc | |
| parent | c0e4eca982078c21f7cf4962b5b38119a888c777 (diff) | |
Migrate most completion to ranked match
Diffstat (limited to 'src/commands.cc')
| -rw-r--r-- | src/commands.cc | 14 |
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({ |
