Commit c3d96ff2 authored by Matthias Clasen's avatar Matthias Clasen

Improve AtkText implementations

There was some regressions from the recent display line fix;
while fixing it improve the test coverage and make GtkEntry
and GtkTextView return identical results.
parent bcc98cf1
......@@ -280,6 +280,7 @@ gtk_text_view_accessible_get_text_before_offset (AtkText *text,
gtk_text_view_backward_display_line_start (view, &start);
end = start;
gtk_text_view_backward_display_line (view, &start);
gtk_text_view_backward_display_line_start (view, &start);
}
else if (boundary_type == ATK_TEXT_BOUNDARY_LINE_END)
{
......@@ -288,12 +289,14 @@ gtk_text_view_accessible_get_text_before_offset (AtkText *text,
{
gtk_text_view_backward_display_line (view, &start);
end = start;
gtk_text_view_forward_display_line_end (view, &end);
if (!gtk_text_iter_is_start (&start))
{
gtk_text_view_backward_display_line (view, &start);
gtk_text_view_forward_display_line_end (view, &start);
if (gtk_text_view_backward_display_line (view, &start))
gtk_text_view_forward_display_line_end (view, &start);
else
gtk_text_iter_set_offset (&start, 0);
}
gtk_text_view_forward_display_line_end (view, &end);
}
else
end = start;
......
......@@ -1143,7 +1143,7 @@ _gtk_pango_get_text_after (PangoLayout *layout,
if (end < n_attrs - 1)
{
end = _gtk_pango_move_words (layout, end, 1);
while (!attrs[end].is_word_end && end < n_attrs - 1)
while (!attrs[end].is_word_start && end < n_attrs - 1)
end = _gtk_pango_move_chars (layout, end, 1);
}
break;
......@@ -1158,7 +1158,7 @@ _gtk_pango_get_text_after (PangoLayout *layout,
case ATK_TEXT_BOUNDARY_SENTENCE_START:
if (_gtk_pango_is_inside_sentence (layout, end))
end = _gtk_pango_move_sentences (layout, end, 1);
while (!attrs[end].is_sentence_end && end < n_attrs - 1)
while (!attrs[end].is_sentence_start && end < n_attrs - 1)
end = _gtk_pango_move_chars (layout, end, 1);
start = end;
if (end < n_attrs - 1)
......@@ -1245,7 +1245,7 @@ _gtk_pango_get_text_at (PangoLayout *layout,
if (_gtk_pango_is_inside_word (layout, end))
end = _gtk_pango_move_words (layout, end, 1);
while (!attrs[end].is_word_start && end < n_attrs - 1)
end = _gtk_pango_move_chars (layout, end, -1);
end = _gtk_pango_move_chars (layout, end, 1);
break;
case ATK_TEXT_BOUNDARY_WORD_END:
......@@ -1262,7 +1262,7 @@ _gtk_pango_get_text_at (PangoLayout *layout,
start = _gtk_pango_move_sentences (layout, start, -1);
if (_gtk_pango_is_inside_sentence (layout, end))
end = _gtk_pango_move_sentences (layout, end, 1);
while (!attrs[end].is_word_end && end < n_attrs - 1)
while (!attrs[end].is_sentence_start && end < n_attrs - 1)
end = _gtk_pango_move_chars (layout, end, 1);
break;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment