InputHandler: complete_word knows best when not to complete
This commit is contained in:
parent
89ba8535e2
commit
eab2cc240a
|
@ -452,6 +452,9 @@ private:
|
||||||
|
|
||||||
static std::pair<CandidateList, BufferIterator> complete_word(const BufferIterator& pos)
|
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 end = pos;
|
||||||
BufferIterator begin = end-1;
|
BufferIterator begin = end-1;
|
||||||
while (not begin.is_begin() and is_word(*begin))
|
while (not begin.is_begin() and is_word(*begin))
|
||||||
|
@ -538,11 +541,7 @@ public:
|
||||||
context().hooks().run_hook("InsertIdle", "", context());
|
context().hooks().run_hook("InsertIdle", "", context());
|
||||||
m_completer.reset(context());
|
m_completer.reset(context());
|
||||||
if (context().editor().selections().size() == 1)
|
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;
|
last_insert().first = mode;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user