From eab2cc240aa58b508a799a779fb90f29460ebe25 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 9 Mar 2013 13:23:47 +0100 Subject: [PATCH] InputHandler: complete_word knows best when not to complete --- src/input_handler.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index 853b9380..e7653152 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -452,6 +452,9 @@ private: static std::pair complete_word(const BufferIterator& pos) { + if (pos.is_begin() or not is_word(*utf8::previous(pos))) + return { {}, pos }; + BufferIterator end = pos; BufferIterator begin = end-1; while (not begin.is_begin() and is_word(*begin)) @@ -538,11 +541,7 @@ public: context().hooks().run_hook("InsertIdle", "", context()); m_completer.reset(context()); if (context().editor().selections().size() == 1) - { - BufferIterator prev = context().editor().selections().back().last(); - if (not prev.is_begin() && is_word(*utf8::previous(prev))) - m_completer.select(context(), 0); - } + m_completer.select(context(), 0); }} { last_insert().first = mode;