Fix select_to_previous_word when cursor is on last buffer char

This commit is contained in:
Maxime Coste 2013-11-12 18:59:19 +00:00
parent 67452c3441
commit c4de866903

View File

@ -131,7 +131,7 @@ template<WordType word_type>
Selection select_to_previous_word(const Buffer& buffer, const Selection& selection) Selection select_to_previous_word(const Buffer& buffer, const Selection& selection)
{ {
Utf8Iterator begin = buffer.iterator_at(selection.last()); Utf8Iterator begin = buffer.iterator_at(selection.last());
if (begin+1 == buffer.end()) if (begin == buffer.begin())
return selection; return selection;
if (categorize<word_type>(*begin) != categorize<word_type>(*(begin-1))) if (categorize<word_type>(*begin) != categorize<word_type>(*(begin-1)))
--begin; --begin;