diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-08-30 11:05:48 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-08-30 23:02:20 +0100 |
| commit | 6071e636a2f950f7b12c85492759754a5981d7aa (patch) | |
| tree | 6778b16f956a87aa758ad8b4c9c5f23f073716d4 /src/insert_completer.hh | |
| parent | f666cd9c69d3e483d38481180dfc2eac8d8f78f6 (diff) | |
Use a named struct for insert completion candidates
Diffstat (limited to 'src/insert_completer.hh')
| -rw-r--r-- | src/insert_completer.hh | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/insert_completer.hh b/src/insert_completer.hh index 99fd1a58..f75e0001 100644 --- a/src/insert_completer.hh +++ b/src/insert_completer.hh @@ -39,14 +39,22 @@ using InsertCompleterDescList = Vector<InsertCompleterDesc, MemoryDomain::Option String option_to_string(const InsertCompleterDesc& opt); void option_from_string(StringView str, InsertCompleterDesc& opt); -using ComplAndDesc = std::pair<String, String>; -using ComplAndDescList = Vector<ComplAndDesc>; - struct InsertCompletion { + struct Candidate + { + String completion; + String docstring; + + bool operator==(const Candidate& other) const { return completion == other.completion; } + bool operator<(const Candidate& other) const { return completion < other.completion; } + }; + + using CandidateList = Vector<Candidate>; + ByteCoord begin; ByteCoord end; - ComplAndDescList candidates; + CandidateList candidates; size_t timestamp; bool is_valid() const { return not candidates.empty(); } @@ -77,10 +85,12 @@ private: void menu_show(); + using CandidateList = InsertCompletion::CandidateList; + const Context& m_context; OptionManager& m_options; InsertCompletion m_completions; - ComplAndDescList m_matching_candidates; + CandidateList m_matching_candidates; int m_current_candidate = -1; }; |
