summaryrefslogtreecommitdiff
path: root/src/completion.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-03-02 13:32:35 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-03-02 13:33:11 +0000
commit1fd7e80f044dde220d5332842ab25caf3374dddf (patch)
tree9c55d312e3dd14146e898733e858dbb01d670d94 /src/completion.hh
parent761d316af672bf38ad87124c4baafb621fe3cf23 (diff)
Rename prefix to query in complete helper function and tweak static_assert
Diffstat (limited to 'src/completion.hh')
-rw-r--r--src/completion.hh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/completion.hh b/src/completion.hh
index 1cc219c0..e2ca294f 100644
--- a/src/completion.hh
+++ b/src/completion.hh
@@ -56,18 +56,18 @@ inline Completions offset_pos(Completions completion, ByteCount offset)
}
template<typename Container>
-CandidateList complete(StringView prefix, ByteCount cursor_pos,
+CandidateList complete(StringView query, ByteCount cursor_pos,
const Container& container)
{
using std::begin;
static_assert(not std::is_same<decltype(*begin(container)), String>::value,
- "complete require long lived strings");
+ "complete require long lived strings, not temporaries");
- prefix = prefix.substr(0, cursor_pos);
+ query = query.substr(0, cursor_pos);
Vector<RankedMatch> matches;
for (const auto& str : container)
{
- if (RankedMatch match{str, prefix})
+ if (RankedMatch match{str, query})
matches.push_back(match);
}
std::sort(matches.begin(), matches.end());