summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-04-17 19:33:49 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-04-17 19:33:49 +0100
commit1d7a481e8107c9f32c8fa139dea4f53a8b8cbc51 (patch)
tree35cb850506474a9aa488671a6c17cf69c2863028 /src/input_handler.cc
parent2b997719c3668cebed04564e50a3a3c3c9f090de (diff)
word completion ignore the word on which the cursor is present
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 802f047b..037bcdcf 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -771,11 +771,17 @@ public:
String prefix{begin, end};
+ while (end != buffer.end() and is_word(*end))
+ ++end;
+
+ String current_word{begin, end};
std::unordered_set<String> matches;
auto bufmatches = get_word_db(buffer).find_prefix(prefix);
matches.insert(bufmatches.begin(), bufmatches.end());
+ matches.erase(current_word);
+
if (other_buffers)
{
for (const auto& buf : BufferManager::instance())