textiter: fix bug in find_visible_by_log_attrs()
find_by_log_attrs() can return true only in this case: return moved && !gtk_text_iter_is_end (arg_iter); So if the iter moved (i.e. something has been found), but is the end iter, find_by_log_attrs() returns false. Now the same checks are made in find_visible_by_log_attrs(). The public functions using find_visible_by_log_attrs() say in their documentation that false is returned for the end iter, hence the check with gtk_text_iter_is_end(). https://bugzilla.gnome.org/show_bug.cgi?id=618852
This commit is contained in:
@@ -3183,12 +3183,19 @@ find_visible_by_log_attrs (GtkTextIter *iter,
|
||||
|
||||
pos = *iter;
|
||||
|
||||
while (find_by_log_attrs (&pos, func, forward))
|
||||
while (TRUE)
|
||||
{
|
||||
GtkTextIter pos_before = pos;
|
||||
|
||||
find_by_log_attrs (&pos, func, forward);
|
||||
|
||||
if (gtk_text_iter_equal (&pos_before, &pos))
|
||||
break;
|
||||
|
||||
if (!_gtk_text_btree_char_is_invisible (&pos))
|
||||
{
|
||||
*iter = pos;
|
||||
return TRUE;
|
||||
return !gtk_text_iter_is_end (iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ test_visible_word_boundaries (void)
|
||||
check_backward_visible_word_start (buffer, 0, 0, FALSE);
|
||||
|
||||
gtk_text_buffer_set_text (buffer, "ab", -1);
|
||||
check_forward_visible_word_end (buffer, 0, 0, FALSE); /* FIXME result_offset should be 2 */
|
||||
check_forward_visible_word_end (buffer, 0, 2, FALSE);
|
||||
|
||||
/* Buffer contents: "b c " with "b" invisible */
|
||||
gtk_text_buffer_set_text (buffer, "", -1);
|
||||
@@ -573,7 +573,7 @@ test_visible_cursor_positions (void)
|
||||
check_visible_cursor_position (buffer, TRUE, 0, 3, TRUE);
|
||||
check_visible_cursor_position (buffer, TRUE, 1, 3, TRUE);
|
||||
check_visible_cursor_position (buffer, TRUE, 2, 3, TRUE);
|
||||
check_visible_cursor_position (buffer, TRUE, 3, 3, FALSE); /* FIXME result offset should be 4, not 3 */
|
||||
check_visible_cursor_position (buffer, TRUE, 3, 4, FALSE);
|
||||
check_visible_cursor_position (buffer, TRUE, 4, 4, FALSE);
|
||||
|
||||
/* backward */
|
||||
|
||||
Reference in New Issue
Block a user