summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-03-09 13:23:47 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-03-09 13:23:47 +0100
commiteab2cc240aa58b508a799a779fb90f29460ebe25 (patch)
treea03b54a71cdc48322b8331dcb9455d43ac430204 /src/input_handler.cc
parent89ba8535e22a051b4488c4047767f44346ed0a9b (diff)
InputHandler: complete_word knows best when not to complete
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc9
1 files 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<CandidateList, BufferIterator> 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;