textiter: fix bug in FindLogAttrFunc functions

attrs[len] is the last PangoLogAttr available, at the iter position after the
last character of the line.

For a line in the middle or the start of the buffer, the '\n' is taken
into account by 'len'. For example the is_word_end is generally reached
before the '\n', not after. But for the last line in the buffer, where
there is no trailing '\n', it is important to test until attrs[len].

The bug didn't occur before because find_by_log_attrs() worked directly
on the iter passed as the function argument. But now it is no longer the
case.

https://bugzilla.gnome.org/show_bug.cgi?id=618852
This commit is contained in:
Sébastien Wilmet
2014-07-15 17:07:14 +02:00
parent 76f3866bd3
commit 69d20f53e2
2 changed files with 6 additions and 6 deletions

View File

@ -2895,7 +2895,7 @@ find_word_end_func (const PangoLogAttr *attrs,
++offset;
/* Find end of next word */
while (offset < len)
while (offset <= len)
{
if (attrs[offset].is_word_end)
{
@ -2982,7 +2982,7 @@ find_sentence_end_func (const PangoLogAttr *attrs,
++offset;
/* Find end of next sentence */
while (offset < len)
while (offset <= len)
{
if (attrs[offset].is_sentence_end)
{
@ -3580,7 +3580,7 @@ find_forward_cursor_pos_func (const PangoLogAttr *attrs,
if (!already_moved_initially)
++offset;
while (offset < len)
while (offset <= len)
{
if (attrs[offset].is_cursor_position)
{