From 9449f763e056badbded390c7a7b96980f8580d8b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 19 Oct 2015 19:39:05 +0100 Subject: [PATCH] Fix removal of duplicated words in insert completion --- src/insert_completer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 214e8f25..ee9ca292 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -127,8 +127,12 @@ InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos) } } unordered_erase(matches, StringView{prefix}); - std::sort(matches.begin(), matches.end()); + std::sort(matches.begin(), matches.end(), + [](const RankedWordAndBuffer& lhs, const RankedWordAndBuffer& rhs) { + return lhs.word < rhs.word; + }); matches.erase(std::unique(matches.begin(), matches.end()), matches.end()); + std::sort(matches.begin(), matches.end()); const auto longest = std::accumulate(matches.begin(), matches.end(), 0_char, [](const CharCount& lhs, const RankedWordAndBuffer& rhs)