2011-09-14 19:41:56 +04:00
|
|
|
#ifndef completion_hh_INCLUDED
|
|
|
|
#define completion_hh_INCLUDED
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2011-10-11 02:38:58 +04:00
|
|
|
#include <functional>
|
2011-09-14 19:41:56 +04:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef std::vector<std::string> CandidateList;
|
|
|
|
|
|
|
|
struct Completions
|
|
|
|
{
|
|
|
|
CandidateList candidates;
|
|
|
|
size_t start;
|
|
|
|
size_t end;
|
|
|
|
|
2011-09-14 23:15:09 +04:00
|
|
|
Completions()
|
|
|
|
: start(0), end(0) {}
|
|
|
|
|
2011-09-14 19:41:56 +04:00
|
|
|
Completions(size_t start, size_t end)
|
|
|
|
: start(start), end(end) {}
|
|
|
|
};
|
|
|
|
|
2011-09-16 13:17:55 +04:00
|
|
|
CandidateList complete_filename(const std::string& prefix,
|
|
|
|
size_t cursor_pos = std::string::npos);
|
2011-09-14 19:41:56 +04:00
|
|
|
|
2011-09-22 22:55:45 +04:00
|
|
|
CandidateList complete_buffername(const std::string& prefix,
|
|
|
|
size_t cursor_pos = std::string::npos);
|
|
|
|
|
2011-10-11 02:38:58 +04:00
|
|
|
typedef std::function<Completions (const std::string&, size_t)> Completer;
|
|
|
|
|
|
|
|
struct NullCompletion
|
|
|
|
{
|
|
|
|
Completions operator() (const std::string&, size_t cursor_pos)
|
|
|
|
{
|
|
|
|
return Completions(cursor_pos, cursor_pos);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-09-14 19:41:56 +04:00
|
|
|
}
|
|
|
|
#endif // completion_hh_INCLUDED
|