summaryrefslogtreecommitdiff
path: root/src/completion.hh
blob: af60ed1b332464a90fbcee720fb56c5b1ab73ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef completion_hh_INCLUDED
#define completion_hh_INCLUDED

#include <string>
#include <vector>
#include <functional>

namespace Kakoune
{

typedef std::vector<std::string> CandidateList;

struct Completions
{
    CandidateList candidates;
    size_t start;
    size_t end;

    Completions()
        : start(0), end(0) {}

    Completions(size_t start, size_t end)
        : start(start), end(end) {}
};

CandidateList complete_filename(const std::string& prefix,
                                size_t cursor_pos = std::string::npos);

typedef std::function<Completions (const std::string&, size_t)> Completer;

inline Completions complete_nothing(const std::string&, size_t cursor_pos)
{
    return Completions(cursor_pos, cursor_pos);
}

}
#endif // completion_hh_INCLUDED