diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-09-22 18:55:45 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-09-22 18:55:45 +0000 |
| commit | 5ca901644f98f88d9fcfd751d8d6ee580de0147d (patch) | |
| tree | c45d3fc02bbb3f77f722e48c9e4ca6c0bf72788c /src/completion.cc | |
| parent | 429536d0f4a7c3cbb6f9c690c3d81ab4a25de581 (diff) | |
Completion: add complete_buffername completer
Diffstat (limited to 'src/completion.cc')
| -rw-r--r-- | src/completion.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/completion.cc b/src/completion.cc index d4e5f04a..7e570def 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -1,5 +1,6 @@ #include "completion.hh" +#include "buffer_manager.hh" #include "utils.hh" #include <dirent.h> @@ -33,4 +34,18 @@ CandidateList complete_filename(const std::string& prefix, return result; } +CandidateList complete_buffername(const std::string& prefix, + size_t cursor_pos) +{ + std::string real_prefix = prefix.substr(0, cursor_pos); + CandidateList result; + for (auto& buffer : BufferManager::instance()) + { + if (buffer.name().substr(0, real_prefix.length()) == real_prefix) + result.push_back(buffer.name()); + } + return result; +} + + } |
