minor cleanup in select_whole_sentence
This commit is contained in:
parent
a1d40f4c17
commit
5079d78747
|
@ -218,6 +218,11 @@ Selection select_to_eol_reverse(const Buffer& buffer, const Selection& selection
|
||||||
return utf8_range(begin, end == buffer.begin() ? end : end+1);
|
return utf8_range(begin, end == buffer.begin() ? end : end+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_end_of_sentence(char c)
|
||||||
|
{
|
||||||
|
return c == '.' or c == ';' or c == '!' or c == '?';
|
||||||
|
}
|
||||||
|
|
||||||
Selection select_whole_sentence(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
|
Selection select_whole_sentence(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
|
||||||
{
|
{
|
||||||
BufferIterator first = buffer.iterator_at(selection.cursor());
|
BufferIterator first = buffer.iterator_at(selection.cursor());
|
||||||
|
@ -237,7 +242,7 @@ Selection select_whole_sentence(const Buffer& buffer, const Selection& selection
|
||||||
++first;
|
++first;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (prev == '.' or prev == ';' or prev == '!' or prev == '?')
|
else if (is_end_of_sentence(prev))
|
||||||
{
|
{
|
||||||
if (saw_non_blank)
|
if (saw_non_blank)
|
||||||
break;
|
break;
|
||||||
|
@ -253,7 +258,7 @@ Selection select_whole_sentence(const Buffer& buffer, const Selection& selection
|
||||||
while (last != buffer.end())
|
while (last != buffer.end())
|
||||||
{
|
{
|
||||||
char cur = *last;
|
char cur = *last;
|
||||||
if (cur == '.' or cur == ';' or cur == '!' or cur == '?' or
|
if (is_end_of_sentence(cur) or
|
||||||
(is_eol(cur) and (last+1 == buffer.end() or is_eol(*(last+1)))))
|
(is_eol(cur) and (last+1 == buffer.end() or is_eol(*(last+1)))))
|
||||||
break;
|
break;
|
||||||
++last;
|
++last;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user