Fix bug in word completer

A bug could be triggered in the word completer when a multiselection
would trigger word completion with one selection being at buffer first
character.
This commit is contained in:
Maxime Coste 2017-06-09 14:21:18 +01:00
parent 64aa6f3fb4
commit 3612eb50e5

View File

@ -97,7 +97,8 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o
{
Utf8It end{buffer.iterator_at(sels[i].cursor()), buffer};
Utf8It begin = end-1;
if (not skip_while_reverse(begin, buffer.begin(), is_word_pred))
if (not skip_while_reverse(begin, buffer.begin(), is_word_pred) and
begin < end) // (begin might == end if end == buffer.begin())
++begin;
if (i == sels.main_index())