summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-04-22 19:31:31 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-04-22 19:32:12 +0100
commit389308dfd812a499df5dac86d98c8e1be9604dea (patch)
tree8f52f1b99ab25d41f0527acdec89262b6ae04c84 /src/input_handler.cc
parent65c818b85970135f9fff3b71432d2a8f331f8526 (diff)
Preserve current word in word completion if found elsewhere
If occurence count in the buffer if greater that one, do not remove it from the matches.
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 037bcdcf..49c02367 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -776,11 +776,13 @@ public:
String current_word{begin, end};
+ auto& word_db = get_word_db(buffer);
std::unordered_set<String> matches;
- auto bufmatches = get_word_db(buffer).find_prefix(prefix);
+ auto bufmatches = word_db.find_prefix(prefix);
matches.insert(bufmatches.begin(), bufmatches.end());
- matches.erase(current_word);
+ if (word_db.get_word_occurences(current_word) <= 1)
+ matches.erase(current_word);
if (other_buffers)
{