From 310a0d4fcca113f1dbc60feaba406f6b5526df43 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 11 Dec 2000 15:51:20 +0000 Subject: [PATCH] Handle chopping off \r\n and 0x2029 in addition to \n before passing to 2000-12-11 Havoc Pennington * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): Handle chopping off \r\n and 0x2029 in addition to \n before passing to PangoLayout * gtk/gtkimcontextsimple.c (gtk_im_context_simple_get_preedit_string): return an empty string if no match is pending * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add assertion that the returned preedit string was sane * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; --- ChangeLog | 17 ++++++++++++++ ChangeLog.pre-2-0 | 17 ++++++++++++++ ChangeLog.pre-2-10 | 17 ++++++++++++++ ChangeLog.pre-2-2 | 17 ++++++++++++++ ChangeLog.pre-2-4 | 17 ++++++++++++++ ChangeLog.pre-2-6 | 17 ++++++++++++++ ChangeLog.pre-2-8 | 17 ++++++++++++++ gtk/gtkimcontext.c | 1 + gtk/gtkimcontextsimple.c | 8 +++++-- gtk/gtktextbtree.c | 14 +++++------ gtk/gtktextbuffer.c | 10 ++++---- gtk/gtktextchild.c | 2 +- gtk/gtktextiter.c | 26 ++++++++++----------- gtk/gtktextiter.h | 4 ++-- gtk/gtktextlayout.c | 50 +++++++++++++++++++++++++++++----------- gtk/gtktextview.c | 4 ++-- gtk/testtext.c | 6 ++--- gtk/testtextbuffer.c | 8 +++---- tests/testtext.c | 6 ++--- tests/testtextbuffer.c | 8 +++---- 20 files changed, 207 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index de0a0e64d9..a85a367670 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index de0a0e64d9..a85a367670 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +2000-12-11 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): + Handle chopping off \r\n and 0x2029 in addition to \n before + passing to PangoLayout + + * gtk/gtkimcontextsimple.c + (gtk_im_context_simple_get_preedit_string): + return an empty string if no match is pending + + * gtk/gtkimcontext.c (gtk_im_context_get_preedit_string): add + assertion that the returned preedit string was sane + + * gtk/gtktext*.[hc], gtk/testtext.c, gtk/testtextbuffer.c: + s/gtk_text_iter_next_char/gtk_text_iter_forward_char/g; + s/gtk_text_iter_prev_char/gtk_text_iter_backward_char/g; + Mon Dec 11 10:02:26 2000 Owen Taylor * gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize): diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c index 00831757ad..6d619470cf 100644 --- a/gtk/gtkimcontext.c +++ b/gtk/gtkimcontext.c @@ -191,6 +191,7 @@ gtk_im_context_get_preedit_string (GtkIMContext *context, klass = GTK_IM_CONTEXT_GET_CLASS (context); klass->get_preedit_string (context, str, attrs, cursor_pos); + g_return_if_fail (str == NULL || g_utf8_validate (*str, -1, NULL)); } /** diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index 4b346dc9c3..36da2c96a9 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -945,6 +945,7 @@ check_hex (GtkIMContextSimple *context_simple, GString *str; gulong n; gchar *nptr = NULL; + gchar buf[7]; str = g_string_new (NULL); @@ -952,7 +953,6 @@ check_hex (GtkIMContextSimple *context_simple, while (i < n_compose) { gunichar ch; - gchar buf[7]; ch = gdk_keyval_to_unicode (context_simple->compose_buffer[i]); @@ -1223,9 +1223,13 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context, len = g_unichar_to_utf8 (context_simple->tentative_match, outbuf); } - g_assert (len <= 25); + g_assert (len < 25); outbuf[len] = '\0'; } + else + { + outbuf[0] = '\0'; + } if (str) *str = g_strdup (outbuf); diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index bc91d8dd09..947a79cd18 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -598,14 +598,14 @@ gtk_text_btree_delete (GtkTextIter *start, GtkTextIter orig_end; orig_end = *end; - gtk_text_iter_prev_char (end); + gtk_text_iter_backward_char (end); --line2; if (gtk_text_iter_get_line_offset (start) == 0 && line1 != 0) { - gtk_text_iter_prev_char (start); + gtk_text_iter_backward_char (start); --line1; } @@ -981,7 +981,7 @@ gtk_text_btree_insert (GtkTextIter *iter, eol += sol; chunk_len = eol - sol; - + seg = _gtk_char_segment_new (&text[sol], chunk_len); char_count_delta += seg->char_count; @@ -1096,7 +1096,7 @@ insert_pixbuf_or_widget_segment (GtkTextIter *iter, gtk_text_btree_get_iter_at_line (tree, &start, line, start_byte_offset); *iter = start; - gtk_text_iter_next_char (iter); /* skip forward past the segment */ + gtk_text_iter_forward_char (iter); /* skip forward past the segment */ gtk_text_btree_invalidate_region (tree, &start, iter); } @@ -1595,7 +1595,7 @@ gtk_text_btree_tag (const GtkTextIter *start_orig, stack = iter_stack_new (); iter = start; /* We don't want to delete a toggle that's at the start iterator. */ - gtk_text_iter_next_char (&iter); + gtk_text_iter_forward_char (&iter); while (gtk_text_iter_forward_to_tag_toggle (&iter, tag)) { if (gtk_text_iter_compare (&iter, &end) >= 0) @@ -2412,7 +2412,7 @@ redisplay_mark (GtkTextLineSegment *mark) mark->body.mark.obj); end = iter; - gtk_text_iter_next_char (&end); + gtk_text_iter_forward_char (&end); gtk_text_btree_invalidate_region (mark->body.mark.tree, &iter, &end); @@ -2434,7 +2434,7 @@ ensure_not_off_end (GtkTextBTree *tree, { if (gtk_text_iter_get_line (iter) == gtk_text_btree_line_count (tree)) - gtk_text_iter_prev_char (iter); + gtk_text_iter_backward_char (iter); } static GtkTextLineSegment* diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 3c658b7391..e6ff89e3c2 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -710,7 +710,7 @@ insert_range_untagged (GtkTextBuffer *buffer, restore_range (r); r = NULL; - gtk_text_iter_next_char (&range_end); + gtk_text_iter_forward_char (&range_end); range_start = range_end; } @@ -718,7 +718,7 @@ insert_range_untagged (GtkTextBuffer *buffer, { /* Just skip anchors */ - gtk_text_iter_next_char (&range_end); + gtk_text_iter_forward_char (&range_end); range_start = range_end; } else @@ -1726,7 +1726,7 @@ gtk_text_buffer_place_cursor (GtkTextBuffer *buffer, real = *where; if (gtk_text_iter_is_last (&real)) - gtk_text_iter_prev_char (&real); + gtk_text_iter_backward_char (&real); gtk_text_btree_place_cursor (get_btree (buffer), &real); gtk_text_buffer_mark_set (buffer, &real, @@ -2116,7 +2116,7 @@ clipboard_get_contents_cb (GtkClipboard *clipboard, gtk_text_buffer_get_bounds (contents, &start, &end); /* strip off the trailing newline, it isn't part of the text that was cut */ - gtk_text_iter_prev_char (&end); + gtk_text_iter_backward_char (&end); str = gtk_text_iter_get_visible_text (&start, &end); gtk_selection_data_set_text (selection_data, str); @@ -2347,7 +2347,7 @@ clipboard_clipboard_buffer_received (GtkClipboard *clipboard, gtk_text_buffer_get_bounds (src_buffer, &start, &end); /* There's an extra newline on clipboard_contents */ - gtk_text_iter_prev_char (&end); + gtk_text_iter_backward_char (&end); paste_from_buffer (request_data, src_buffer, &start, &end); diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c index db93231e6c..5595e2d4ce 100644 --- a/gtk/gtktextchild.c +++ b/gtk/gtktextchild.c @@ -450,7 +450,7 @@ gtk_text_child_anchor_queue_resize (GtkTextChildAnchor *anchor, gtk_text_buffer_get_iter_at_child_anchor (layout->buffer, &start, anchor); end = start; - gtk_text_iter_next_char (&end); + gtk_text_iter_forward_char (&end); gtk_text_layout_invalidate (layout, &start, &end); } diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index d3f0004cd7..4d2ea8522e 100644 --- a/gtk/gtktextiter.c +++ b/gtk/gtktextiter.c @@ -1362,7 +1362,7 @@ gtk_text_iter_ends_line (const GtkTextIter *iter) * we aren't the end of the line */ GtkTextIter tmp = *iter; - if (!gtk_text_iter_prev_char (&tmp)) + if (!gtk_text_iter_backward_char (&tmp)) return FALSE; return gtk_text_iter_get_char (&tmp) != '\r'; @@ -1924,21 +1924,21 @@ gtk_text_iter_backward_indexable_segment (GtkTextIter *iter) } /** - * gtk_text_iter_next_char: + * gtk_text_iter_forward_char: * @iter: an iterator * * Moves @iter forward by one character offset. Note that images * embedded in the buffer occupy 1 character slot, so - * gtk_text_iter_next_char () may actually move onto an image instead + * gtk_text_iter_forward_char () may actually move onto an image instead * of a character, if you have images in your buffer. If @iter is the * end iterator or one character before it, @iter will now point at - * the end iterator, and gtk_text_iter_next_char () returns FALSE for + * the end iterator, and gtk_text_iter_forward_char () returns FALSE for * convenience when writing loops. * * Return value: whether the new position is the end iterator **/ gboolean -gtk_text_iter_next_char (GtkTextIter *iter) +gtk_text_iter_forward_char (GtkTextIter *iter) { GtkTextRealIter *real; @@ -1956,18 +1956,18 @@ gtk_text_iter_next_char (GtkTextIter *iter) } /** - * gtk_text_iter_prev_char: + * gtk_text_iter_backward_char: * @iter: an iterator * * Moves backward by one character offset. Returns TRUE if movement * was possible; if @iter was the first in the buffer (character - * offset 0), gtk_text_iter_prev_char () returns FALSE for convenience when + * offset 0), gtk_text_iter_backward_char () returns FALSE for convenience when * writing loops. * * Return value: whether movement was possible **/ gboolean -gtk_text_iter_prev_char (GtkTextIter *iter) +gtk_text_iter_backward_char (GtkTextIter *iter) { g_return_val_if_fail (iter != NULL, FALSE); @@ -2990,7 +2990,7 @@ gtk_text_iter_forward_find_char (GtkTextIter *iter, while ((limit == NULL || !gtk_text_iter_equal (limit, iter)) && - gtk_text_iter_next_char (iter)) + gtk_text_iter_forward_char (iter)) { if (matches_pred (iter, pred, user_data)) return TRUE; @@ -3014,7 +3014,7 @@ gtk_text_iter_backward_find_char (GtkTextIter *iter, while ((limit == NULL || !gtk_text_iter_equal (limit, iter)) && - gtk_text_iter_prev_char (iter)) + gtk_text_iter_backward_char (iter)) { if (matches_pred (iter, pred, user_data)) return TRUE; @@ -3049,7 +3049,7 @@ forward_chars_with_skipping (GtkTextIter *iter, gtk_text_btree_char_is_invisible (iter)) ignored = TRUE; - gtk_text_iter_next_char (iter); + gtk_text_iter_forward_char (iter); if (!ignored) --i; @@ -3253,7 +3253,7 @@ gtk_text_iter_forward_search (const GtkTextIter *iter, /* If we can move one char, return the empty string there */ match = *iter; - if (gtk_text_iter_next_char (&match)) + if (gtk_text_iter_forward_char (&match)) { if (limit && gtk_text_iter_equal (&match, limit)) @@ -3575,7 +3575,7 @@ gtk_text_iter_backward_search (const GtkTextIter *iter, if (limit && gtk_text_iter_equal (limit, &match)) return FALSE; - if (gtk_text_iter_prev_char (&match)) + if (gtk_text_iter_backward_char (&match)) { if (match_start) *match_start = match; diff --git a/gtk/gtktextiter.h b/gtk/gtktextiter.h index 0643b2153d..da5e761d4e 100644 --- a/gtk/gtktextiter.h +++ b/gtk/gtktextiter.h @@ -143,8 +143,8 @@ gboolean gtk_text_iter_is_first (const GtkTextIter *iter); * Moving around the buffer */ -gboolean gtk_text_iter_next_char (GtkTextIter *iter); -gboolean gtk_text_iter_prev_char (GtkTextIter *iter); +gboolean gtk_text_iter_forward_char (GtkTextIter *iter); +gboolean gtk_text_iter_backward_char (GtkTextIter *iter); gboolean gtk_text_iter_forward_chars (GtkTextIter *iter, gint count); gboolean gtk_text_iter_backward_chars (GtkTextIter *iter, diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 877eadc3e9..ba758f99dd 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1683,7 +1683,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, * if there are toggles in-between */ - gint byte_count = 0; + gint bytes = 0; GtkTextLineSegment *prev_seg = NULL; while (seg) @@ -1692,7 +1692,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, { memcpy (text + byte_offset, seg->body.chars, seg->byte_count); byte_offset += seg->byte_count; - byte_count += seg->byte_count; + bytes += seg->byte_count; } else if (seg->type == >k_text_right_mark_type || seg->type == >k_text_left_mark_type) @@ -1721,11 +1721,11 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, seg = prev_seg; /* Back up one */ add_generic_attrs (layout, &style->appearance, - byte_count, - attrs, byte_offset - byte_count, + bytes, + attrs, byte_offset - bytes, size_only, TRUE); - add_text_attrs (layout, style, byte_count, attrs, - byte_offset - byte_count, size_only); + add_text_attrs (layout, style, bytes, attrs, + byte_offset - bytes, size_only); } else if (seg->type == >k_text_pixbuf_type) { @@ -1793,7 +1793,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, style = get_style (layout, &iter); add_preedit_attrs (layout, style, attrs, byte_offset, size_only); release_style (layout, style); - + memcpy (text + byte_offset, layout->preedit_string, layout->preedit_len); byte_offset += layout->preedit_len; @@ -1817,7 +1817,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, seg = seg->next; } - + if (!para_values_set) { style = get_style (layout, &iter); @@ -1825,10 +1825,34 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, release_style (layout, style); } - /* Pango doesn't want the trailing new line */ - if (byte_offset > 0 && text[byte_offset - 1] == '\n') - byte_offset--; + g_assert (byte_offset == byte_count); + + /* Pango doesn't want the trailing paragraph delimiters */ + { + /* Only one character has type G_UNICODE_PARAGRAPH_SEPARATOR in + * Unicode 3.0; update this if that changes. + */ +#define PARAGRAPH_SEPARATOR 0x2029 + gunichar ch = 0; + + if (byte_offset > 0) + { + const char *prev = g_utf8_prev_char (text + byte_offset); + ch = g_utf8_get_char (prev); + if (ch == PARAGRAPH_SEPARATOR || ch == '\r' || ch == '\n') + byte_offset = prev - text; /* chop off */ + + if (ch == '\n' && byte_offset > 0) + { + /* Possibly chop a CR as well */ + prev = g_utf8_prev_char (text + byte_offset); + if (*prev == '\r') + --byte_offset; + } + } + } + pango_layout_set_text (display->layout, text, byte_offset); pango_layout_set_attributes (display->layout, attrs); @@ -2565,7 +2589,7 @@ gtk_text_layout_move_iter_to_line_end (GtkTextLayout *layout, * forced break not at whitespace. Real fix is to keep track * of whether marks are at leading or trailing edge? */ if (direction > 0 && layout_line->length > 0 && !gtk_text_iter_ends_line (iter)) - gtk_text_iter_prev_char (iter); + gtk_text_iter_backward_char (iter); break; } @@ -2790,7 +2814,7 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout, line_display_index_to_iter (layout, display, iter, new_index, new_trailing); if (extra_back) - gtk_text_iter_prev_char (iter); + gtk_text_iter_backward_char (iter); } gtk_text_layout_free_line_display (layout, display); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 4bcd9bdabc..3bb70459bd 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3290,7 +3290,7 @@ find_whitepace_region (const GtkTextIter *center, *end = *center; if (gtk_text_iter_backward_find_char (start, not_whitespace, NULL, NULL)) - gtk_text_iter_next_char (start); /* we want the first whitespace... */ + gtk_text_iter_forward_char (start); /* we want the first whitespace... */ if (whitespace (gtk_text_iter_get_char (end), NULL)) gtk_text_iter_forward_find_char (end, not_whitespace, NULL, NULL); @@ -3362,7 +3362,7 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view, */ if (gtk_text_iter_get_char (&end) == '\n') { - gtk_text_iter_next_char (&end); + gtk_text_iter_forward_char (&end); --count; } diff --git a/gtk/testtext.c b/gtk/testtext.c index 24cc6b775e..6daeebae2c 100644 --- a/gtk/testtext.c +++ b/gtk/testtext.c @@ -1053,8 +1053,8 @@ do_apply_colors (gpointer callback_data, gboolean done = FALSE; next = start; - gtk_text_iter_next_char (&next); - gtk_text_iter_next_char (&next); + gtk_text_iter_forward_char (&next); + gtk_text_iter_forward_char (&next); if (gtk_text_iter_compare (&next, &end) > 0) { @@ -1105,7 +1105,7 @@ dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data) gtk_text_buffer_get_bounds (buffer, &start, &end); /* Remove trailing newline */ - gtk_text_iter_prev_char (&end); + gtk_text_iter_backward_char (&end); search_string = gtk_text_iter_get_text (&start, &end); diff --git a/gtk/testtextbuffer.c b/gtk/testtextbuffer.c index e2b3072578..e981ce9547 100644 --- a/gtk/testtextbuffer.c +++ b/gtk/testtextbuffer.c @@ -114,7 +114,7 @@ count_toggles_in_buffer (GtkTextBuffer *buffer, { count += count_toggles_at_iter (&iter, of_tag); } - while (gtk_text_iter_next_char (&iter)); + while (gtk_text_iter_forward_char (&iter)); /* Do the end iterator, because forward_char won't return TRUE * on it. @@ -296,7 +296,7 @@ run_tests (GtkTextBuffer *buffer) g_error ("iterators ran out before chars (offset %d of %d)", i, num_chars); - gtk_text_iter_next_char (&iter); + gtk_text_iter_forward_char (&iter); gtk_text_buffer_move_mark (buffer, bar_mark, &iter); @@ -359,14 +359,14 @@ run_tests (GtkTextBuffer *buffer) if (i > 0) { - if (!gtk_text_iter_prev_char (&iter)) + if (!gtk_text_iter_backward_char (&iter)) g_error ("iterators ran out before char indexes"); gtk_text_buffer_move_mark (buffer, bar_mark, &iter); } else { - if (gtk_text_iter_prev_char (&iter)) + if (gtk_text_iter_backward_char (&iter)) g_error ("went backward from 0?"); } diff --git a/tests/testtext.c b/tests/testtext.c index 24cc6b775e..6daeebae2c 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -1053,8 +1053,8 @@ do_apply_colors (gpointer callback_data, gboolean done = FALSE; next = start; - gtk_text_iter_next_char (&next); - gtk_text_iter_next_char (&next); + gtk_text_iter_forward_char (&next); + gtk_text_iter_forward_char (&next); if (gtk_text_iter_compare (&next, &end) > 0) { @@ -1105,7 +1105,7 @@ dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data) gtk_text_buffer_get_bounds (buffer, &start, &end); /* Remove trailing newline */ - gtk_text_iter_prev_char (&end); + gtk_text_iter_backward_char (&end); search_string = gtk_text_iter_get_text (&start, &end); diff --git a/tests/testtextbuffer.c b/tests/testtextbuffer.c index e2b3072578..e981ce9547 100644 --- a/tests/testtextbuffer.c +++ b/tests/testtextbuffer.c @@ -114,7 +114,7 @@ count_toggles_in_buffer (GtkTextBuffer *buffer, { count += count_toggles_at_iter (&iter, of_tag); } - while (gtk_text_iter_next_char (&iter)); + while (gtk_text_iter_forward_char (&iter)); /* Do the end iterator, because forward_char won't return TRUE * on it. @@ -296,7 +296,7 @@ run_tests (GtkTextBuffer *buffer) g_error ("iterators ran out before chars (offset %d of %d)", i, num_chars); - gtk_text_iter_next_char (&iter); + gtk_text_iter_forward_char (&iter); gtk_text_buffer_move_mark (buffer, bar_mark, &iter); @@ -359,14 +359,14 @@ run_tests (GtkTextBuffer *buffer) if (i > 0) { - if (!gtk_text_iter_prev_char (&iter)) + if (!gtk_text_iter_backward_char (&iter)) g_error ("iterators ran out before char indexes"); gtk_text_buffer_move_mark (buffer, bar_mark, &iter); } else { - if (gtk_text_iter_prev_char (&iter)) + if (gtk_text_iter_backward_char (&iter)) g_error ("went backward from 0?"); }