diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 92adf361..e1cc5319 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -115,12 +115,11 @@ InsertCompletion complete_word(const SelectionList& sels, const Buffer* buffer; }; - Vector matches; auto& word_db = get_word_db(buffer); - for (auto& m : word_db.find_matching(prefix)) - matches.push_back({ m, &buffer }); - + Vector matches = word_db.find_matching(prefix) + | transform([&](auto& m) { return RankedMatchAndBuffer{m, &buffer}; }) + | gather(); // Remove words that are being edited for (auto& word_count : sel_word_counts) {