summaryrefslogtreecommitdiff
path: root/gtk/gtktextiter.c
diff options
context:
space:
mode:
authorSébastien Wilmet <swilmet@gnome.org>2014-07-15 17:07:14 +0200
committerSébastien Wilmet <swilmet@gnome.org>2014-07-17 12:56:56 +0200
commit69d20f53e237806a64d2ffbe0a859b696667a76f (patch)
treeed0d2d73236a6ccc5262ce3c2ba8ed4e6b4017cf /gtk/gtktextiter.c
parent76f3866bd35b29edec770e107d8e2bb44fbd5ec9 (diff)
downloadgtk+-69d20f53e237806a64d2ffbe0a859b696667a76f.tar.gz
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
Diffstat (limited to 'gtk/gtktextiter.c')
-rw-r--r--gtk/gtktextiter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index bfc296eb86..889103e53f 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -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)
{