mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
Handle chopping off \r\n and 0x2029 in addition to \n before passing to
2000-12-11 Havoc Pennington <hp@redhat.com> * 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;
This commit is contained in:
parent
116853db94
commit
310a0d4fcc
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
2000-12-11 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* 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 <otaylor@redhat.com>
|
Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
* gtk/gtkimcontextsimple.c (gtk_im_context_simple_finalize):
|
||||||
|
@ -191,6 +191,7 @@ gtk_im_context_get_preedit_string (GtkIMContext *context,
|
|||||||
|
|
||||||
klass = GTK_IM_CONTEXT_GET_CLASS (context);
|
klass = GTK_IM_CONTEXT_GET_CLASS (context);
|
||||||
klass->get_preedit_string (context, str, attrs, cursor_pos);
|
klass->get_preedit_string (context, str, attrs, cursor_pos);
|
||||||
|
g_return_if_fail (str == NULL || g_utf8_validate (*str, -1, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -945,6 +945,7 @@ check_hex (GtkIMContextSimple *context_simple,
|
|||||||
GString *str;
|
GString *str;
|
||||||
gulong n;
|
gulong n;
|
||||||
gchar *nptr = NULL;
|
gchar *nptr = NULL;
|
||||||
|
gchar buf[7];
|
||||||
|
|
||||||
str = g_string_new (NULL);
|
str = g_string_new (NULL);
|
||||||
|
|
||||||
@ -952,7 +953,6 @@ check_hex (GtkIMContextSimple *context_simple,
|
|||||||
while (i < n_compose)
|
while (i < n_compose)
|
||||||
{
|
{
|
||||||
gunichar ch;
|
gunichar ch;
|
||||||
gchar buf[7];
|
|
||||||
|
|
||||||
ch = gdk_keyval_to_unicode (context_simple->compose_buffer[i]);
|
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);
|
len = g_unichar_to_utf8 (context_simple->tentative_match, outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (len <= 25);
|
g_assert (len < 25);
|
||||||
outbuf[len] = '\0';
|
outbuf[len] = '\0';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outbuf[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
*str = g_strdup (outbuf);
|
*str = g_strdup (outbuf);
|
||||||
|
@ -598,14 +598,14 @@ gtk_text_btree_delete (GtkTextIter *start,
|
|||||||
GtkTextIter orig_end;
|
GtkTextIter orig_end;
|
||||||
|
|
||||||
orig_end = *end;
|
orig_end = *end;
|
||||||
gtk_text_iter_prev_char (end);
|
gtk_text_iter_backward_char (end);
|
||||||
|
|
||||||
--line2;
|
--line2;
|
||||||
|
|
||||||
if (gtk_text_iter_get_line_offset (start) == 0 &&
|
if (gtk_text_iter_get_line_offset (start) == 0 &&
|
||||||
line1 != 0)
|
line1 != 0)
|
||||||
{
|
{
|
||||||
gtk_text_iter_prev_char (start);
|
gtk_text_iter_backward_char (start);
|
||||||
--line1;
|
--line1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ gtk_text_btree_insert (GtkTextIter *iter,
|
|||||||
eol += sol;
|
eol += sol;
|
||||||
|
|
||||||
chunk_len = eol - sol;
|
chunk_len = eol - sol;
|
||||||
|
|
||||||
seg = _gtk_char_segment_new (&text[sol], chunk_len);
|
seg = _gtk_char_segment_new (&text[sol], chunk_len);
|
||||||
|
|
||||||
char_count_delta += seg->char_count;
|
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);
|
gtk_text_btree_get_iter_at_line (tree, &start, line, start_byte_offset);
|
||||||
|
|
||||||
*iter = start;
|
*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);
|
gtk_text_btree_invalidate_region (tree, &start, iter);
|
||||||
}
|
}
|
||||||
@ -1595,7 +1595,7 @@ gtk_text_btree_tag (const GtkTextIter *start_orig,
|
|||||||
stack = iter_stack_new ();
|
stack = iter_stack_new ();
|
||||||
iter = start;
|
iter = start;
|
||||||
/* We don't want to delete a toggle that's at the start iterator. */
|
/* 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))
|
while (gtk_text_iter_forward_to_tag_toggle (&iter, tag))
|
||||||
{
|
{
|
||||||
if (gtk_text_iter_compare (&iter, &end) >= 0)
|
if (gtk_text_iter_compare (&iter, &end) >= 0)
|
||||||
@ -2412,7 +2412,7 @@ redisplay_mark (GtkTextLineSegment *mark)
|
|||||||
mark->body.mark.obj);
|
mark->body.mark.obj);
|
||||||
|
|
||||||
end = iter;
|
end = iter;
|
||||||
gtk_text_iter_next_char (&end);
|
gtk_text_iter_forward_char (&end);
|
||||||
|
|
||||||
gtk_text_btree_invalidate_region (mark->body.mark.tree,
|
gtk_text_btree_invalidate_region (mark->body.mark.tree,
|
||||||
&iter, &end);
|
&iter, &end);
|
||||||
@ -2434,7 +2434,7 @@ ensure_not_off_end (GtkTextBTree *tree,
|
|||||||
{
|
{
|
||||||
if (gtk_text_iter_get_line (iter) ==
|
if (gtk_text_iter_get_line (iter) ==
|
||||||
gtk_text_btree_line_count (tree))
|
gtk_text_btree_line_count (tree))
|
||||||
gtk_text_iter_prev_char (iter);
|
gtk_text_iter_backward_char (iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkTextLineSegment*
|
static GtkTextLineSegment*
|
||||||
|
@ -710,7 +710,7 @@ insert_range_untagged (GtkTextBuffer *buffer,
|
|||||||
restore_range (r);
|
restore_range (r);
|
||||||
r = NULL;
|
r = NULL;
|
||||||
|
|
||||||
gtk_text_iter_next_char (&range_end);
|
gtk_text_iter_forward_char (&range_end);
|
||||||
|
|
||||||
range_start = range_end;
|
range_start = range_end;
|
||||||
}
|
}
|
||||||
@ -718,7 +718,7 @@ insert_range_untagged (GtkTextBuffer *buffer,
|
|||||||
{
|
{
|
||||||
/* Just skip anchors */
|
/* Just skip anchors */
|
||||||
|
|
||||||
gtk_text_iter_next_char (&range_end);
|
gtk_text_iter_forward_char (&range_end);
|
||||||
range_start = range_end;
|
range_start = range_end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1726,7 +1726,7 @@ gtk_text_buffer_place_cursor (GtkTextBuffer *buffer,
|
|||||||
real = *where;
|
real = *where;
|
||||||
|
|
||||||
if (gtk_text_iter_is_last (&real))
|
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_btree_place_cursor (get_btree (buffer), &real);
|
||||||
gtk_text_buffer_mark_set (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);
|
gtk_text_buffer_get_bounds (contents, &start, &end);
|
||||||
/* strip off the trailing newline, it isn't part of the text that was cut */
|
/* 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);
|
str = gtk_text_iter_get_visible_text (&start, &end);
|
||||||
gtk_selection_data_set_text (selection_data, str);
|
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);
|
gtk_text_buffer_get_bounds (src_buffer, &start, &end);
|
||||||
/* There's an extra newline on clipboard_contents */
|
/* 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,
|
paste_from_buffer (request_data, src_buffer,
|
||||||
&start, &end);
|
&start, &end);
|
||||||
|
@ -450,7 +450,7 @@ gtk_text_child_anchor_queue_resize (GtkTextChildAnchor *anchor,
|
|||||||
gtk_text_buffer_get_iter_at_child_anchor (layout->buffer,
|
gtk_text_buffer_get_iter_at_child_anchor (layout->buffer,
|
||||||
&start, anchor);
|
&start, anchor);
|
||||||
end = start;
|
end = start;
|
||||||
gtk_text_iter_next_char (&end);
|
gtk_text_iter_forward_char (&end);
|
||||||
|
|
||||||
gtk_text_layout_invalidate (layout, &start, &end);
|
gtk_text_layout_invalidate (layout, &start, &end);
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1362,7 @@ gtk_text_iter_ends_line (const GtkTextIter *iter)
|
|||||||
* we aren't the end of the line
|
* we aren't the end of the line
|
||||||
*/
|
*/
|
||||||
GtkTextIter tmp = *iter;
|
GtkTextIter tmp = *iter;
|
||||||
if (!gtk_text_iter_prev_char (&tmp))
|
if (!gtk_text_iter_backward_char (&tmp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return gtk_text_iter_get_char (&tmp) != '\r';
|
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
|
* @iter: an iterator
|
||||||
*
|
*
|
||||||
* Moves @iter forward by one character offset. Note that images
|
* Moves @iter forward by one character offset. Note that images
|
||||||
* embedded in the buffer occupy 1 character slot, so
|
* 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
|
* 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
|
* 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.
|
* convenience when writing loops.
|
||||||
*
|
*
|
||||||
* Return value: whether the new position is the end iterator
|
* Return value: whether the new position is the end iterator
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_text_iter_next_char (GtkTextIter *iter)
|
gtk_text_iter_forward_char (GtkTextIter *iter)
|
||||||
{
|
{
|
||||||
GtkTextRealIter *real;
|
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
|
* @iter: an iterator
|
||||||
*
|
*
|
||||||
* Moves backward by one character offset. Returns TRUE if movement
|
* Moves backward by one character offset. Returns TRUE if movement
|
||||||
* was possible; if @iter was the first in the buffer (character
|
* 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.
|
* writing loops.
|
||||||
*
|
*
|
||||||
* Return value: whether movement was possible
|
* Return value: whether movement was possible
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gtk_text_iter_prev_char (GtkTextIter *iter)
|
gtk_text_iter_backward_char (GtkTextIter *iter)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (iter != NULL, FALSE);
|
g_return_val_if_fail (iter != NULL, FALSE);
|
||||||
|
|
||||||
@ -2990,7 +2990,7 @@ gtk_text_iter_forward_find_char (GtkTextIter *iter,
|
|||||||
|
|
||||||
while ((limit == NULL ||
|
while ((limit == NULL ||
|
||||||
!gtk_text_iter_equal (limit, iter)) &&
|
!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))
|
if (matches_pred (iter, pred, user_data))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -3014,7 +3014,7 @@ gtk_text_iter_backward_find_char (GtkTextIter *iter,
|
|||||||
|
|
||||||
while ((limit == NULL ||
|
while ((limit == NULL ||
|
||||||
!gtk_text_iter_equal (limit, iter)) &&
|
!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))
|
if (matches_pred (iter, pred, user_data))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -3049,7 +3049,7 @@ forward_chars_with_skipping (GtkTextIter *iter,
|
|||||||
gtk_text_btree_char_is_invisible (iter))
|
gtk_text_btree_char_is_invisible (iter))
|
||||||
ignored = TRUE;
|
ignored = TRUE;
|
||||||
|
|
||||||
gtk_text_iter_next_char (iter);
|
gtk_text_iter_forward_char (iter);
|
||||||
|
|
||||||
if (!ignored)
|
if (!ignored)
|
||||||
--i;
|
--i;
|
||||||
@ -3253,7 +3253,7 @@ gtk_text_iter_forward_search (const GtkTextIter *iter,
|
|||||||
/* If we can move one char, return the empty string there */
|
/* If we can move one char, return the empty string there */
|
||||||
match = *iter;
|
match = *iter;
|
||||||
|
|
||||||
if (gtk_text_iter_next_char (&match))
|
if (gtk_text_iter_forward_char (&match))
|
||||||
{
|
{
|
||||||
if (limit &&
|
if (limit &&
|
||||||
gtk_text_iter_equal (&match, 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))
|
if (limit && gtk_text_iter_equal (limit, &match))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (gtk_text_iter_prev_char (&match))
|
if (gtk_text_iter_backward_char (&match))
|
||||||
{
|
{
|
||||||
if (match_start)
|
if (match_start)
|
||||||
*match_start = match;
|
*match_start = match;
|
||||||
|
@ -143,8 +143,8 @@ gboolean gtk_text_iter_is_first (const GtkTextIter *iter);
|
|||||||
* Moving around the buffer
|
* Moving around the buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gboolean gtk_text_iter_next_char (GtkTextIter *iter);
|
gboolean gtk_text_iter_forward_char (GtkTextIter *iter);
|
||||||
gboolean gtk_text_iter_prev_char (GtkTextIter *iter);
|
gboolean gtk_text_iter_backward_char (GtkTextIter *iter);
|
||||||
gboolean gtk_text_iter_forward_chars (GtkTextIter *iter,
|
gboolean gtk_text_iter_forward_chars (GtkTextIter *iter,
|
||||||
gint count);
|
gint count);
|
||||||
gboolean gtk_text_iter_backward_chars (GtkTextIter *iter,
|
gboolean gtk_text_iter_backward_chars (GtkTextIter *iter,
|
||||||
|
@ -1683,7 +1683,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
* if there are toggles in-between
|
* if there are toggles in-between
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gint byte_count = 0;
|
gint bytes = 0;
|
||||||
GtkTextLineSegment *prev_seg = NULL;
|
GtkTextLineSegment *prev_seg = NULL;
|
||||||
|
|
||||||
while (seg)
|
while (seg)
|
||||||
@ -1692,7 +1692,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
{
|
{
|
||||||
memcpy (text + byte_offset, seg->body.chars, seg->byte_count);
|
memcpy (text + byte_offset, seg->body.chars, seg->byte_count);
|
||||||
byte_offset += 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 ||
|
else if (seg->type == >k_text_right_mark_type ||
|
||||||
seg->type == >k_text_left_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 */
|
seg = prev_seg; /* Back up one */
|
||||||
add_generic_attrs (layout, &style->appearance,
|
add_generic_attrs (layout, &style->appearance,
|
||||||
byte_count,
|
bytes,
|
||||||
attrs, byte_offset - byte_count,
|
attrs, byte_offset - bytes,
|
||||||
size_only, TRUE);
|
size_only, TRUE);
|
||||||
add_text_attrs (layout, style, byte_count, attrs,
|
add_text_attrs (layout, style, bytes, attrs,
|
||||||
byte_offset - byte_count, size_only);
|
byte_offset - bytes, size_only);
|
||||||
}
|
}
|
||||||
else if (seg->type == >k_text_pixbuf_type)
|
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);
|
style = get_style (layout, &iter);
|
||||||
add_preedit_attrs (layout, style, attrs, byte_offset, size_only);
|
add_preedit_attrs (layout, style, attrs, byte_offset, size_only);
|
||||||
release_style (layout, style);
|
release_style (layout, style);
|
||||||
|
|
||||||
memcpy (text + byte_offset, layout->preedit_string, layout->preedit_len);
|
memcpy (text + byte_offset, layout->preedit_string, layout->preedit_len);
|
||||||
byte_offset += layout->preedit_len;
|
byte_offset += layout->preedit_len;
|
||||||
|
|
||||||
@ -1817,7 +1817,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
|
|
||||||
seg = seg->next;
|
seg = seg->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!para_values_set)
|
if (!para_values_set)
|
||||||
{
|
{
|
||||||
style = get_style (layout, &iter);
|
style = get_style (layout, &iter);
|
||||||
@ -1825,10 +1825,34 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
release_style (layout, style);
|
release_style (layout, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pango doesn't want the trailing new line */
|
g_assert (byte_offset == byte_count);
|
||||||
if (byte_offset > 0 && text[byte_offset - 1] == '\n')
|
|
||||||
byte_offset--;
|
/* 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_text (display->layout, text, byte_offset);
|
||||||
pango_layout_set_attributes (display->layout, attrs);
|
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
|
* forced break not at whitespace. Real fix is to keep track
|
||||||
* of whether marks are at leading or trailing edge? */
|
* of whether marks are at leading or trailing edge? */
|
||||||
if (direction > 0 && layout_line->length > 0 && !gtk_text_iter_ends_line (iter))
|
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;
|
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);
|
line_display_index_to_iter (layout, display, iter, new_index, new_trailing);
|
||||||
if (extra_back)
|
if (extra_back)
|
||||||
gtk_text_iter_prev_char (iter);
|
gtk_text_iter_backward_char (iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_text_layout_free_line_display (layout, display);
|
gtk_text_layout_free_line_display (layout, display);
|
||||||
|
@ -3290,7 +3290,7 @@ find_whitepace_region (const GtkTextIter *center,
|
|||||||
*end = *center;
|
*end = *center;
|
||||||
|
|
||||||
if (gtk_text_iter_backward_find_char (start, not_whitespace, NULL, NULL))
|
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))
|
if (whitespace (gtk_text_iter_get_char (end), NULL))
|
||||||
gtk_text_iter_forward_find_char (end, not_whitespace, NULL, 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')
|
if (gtk_text_iter_get_char (&end) == '\n')
|
||||||
{
|
{
|
||||||
gtk_text_iter_next_char (&end);
|
gtk_text_iter_forward_char (&end);
|
||||||
--count;
|
--count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,8 +1053,8 @@ do_apply_colors (gpointer callback_data,
|
|||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
|
||||||
next = start;
|
next = start;
|
||||||
gtk_text_iter_next_char (&next);
|
gtk_text_iter_forward_char (&next);
|
||||||
gtk_text_iter_next_char (&next);
|
gtk_text_iter_forward_char (&next);
|
||||||
|
|
||||||
if (gtk_text_iter_compare (&next, &end) > 0)
|
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);
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||||
|
|
||||||
/* Remove trailing newline */
|
/* Remove trailing newline */
|
||||||
gtk_text_iter_prev_char (&end);
|
gtk_text_iter_backward_char (&end);
|
||||||
|
|
||||||
search_string = gtk_text_iter_get_text (&start, &end);
|
search_string = gtk_text_iter_get_text (&start, &end);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ count_toggles_in_buffer (GtkTextBuffer *buffer,
|
|||||||
{
|
{
|
||||||
count += count_toggles_at_iter (&iter, of_tag);
|
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
|
/* Do the end iterator, because forward_char won't return TRUE
|
||||||
* on it.
|
* on it.
|
||||||
@ -296,7 +296,7 @@ run_tests (GtkTextBuffer *buffer)
|
|||||||
g_error ("iterators ran out before chars (offset %d of %d)",
|
g_error ("iterators ran out before chars (offset %d of %d)",
|
||||||
i, num_chars);
|
i, num_chars);
|
||||||
|
|
||||||
gtk_text_iter_next_char (&iter);
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
|
||||||
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
||||||
|
|
||||||
@ -359,14 +359,14 @@ run_tests (GtkTextBuffer *buffer)
|
|||||||
|
|
||||||
if (i > 0)
|
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");
|
g_error ("iterators ran out before char indexes");
|
||||||
|
|
||||||
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gtk_text_iter_prev_char (&iter))
|
if (gtk_text_iter_backward_char (&iter))
|
||||||
g_error ("went backward from 0?");
|
g_error ("went backward from 0?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,8 +1053,8 @@ do_apply_colors (gpointer callback_data,
|
|||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
|
||||||
next = start;
|
next = start;
|
||||||
gtk_text_iter_next_char (&next);
|
gtk_text_iter_forward_char (&next);
|
||||||
gtk_text_iter_next_char (&next);
|
gtk_text_iter_forward_char (&next);
|
||||||
|
|
||||||
if (gtk_text_iter_compare (&next, &end) > 0)
|
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);
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||||
|
|
||||||
/* Remove trailing newline */
|
/* Remove trailing newline */
|
||||||
gtk_text_iter_prev_char (&end);
|
gtk_text_iter_backward_char (&end);
|
||||||
|
|
||||||
search_string = gtk_text_iter_get_text (&start, &end);
|
search_string = gtk_text_iter_get_text (&start, &end);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ count_toggles_in_buffer (GtkTextBuffer *buffer,
|
|||||||
{
|
{
|
||||||
count += count_toggles_at_iter (&iter, of_tag);
|
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
|
/* Do the end iterator, because forward_char won't return TRUE
|
||||||
* on it.
|
* on it.
|
||||||
@ -296,7 +296,7 @@ run_tests (GtkTextBuffer *buffer)
|
|||||||
g_error ("iterators ran out before chars (offset %d of %d)",
|
g_error ("iterators ran out before chars (offset %d of %d)",
|
||||||
i, num_chars);
|
i, num_chars);
|
||||||
|
|
||||||
gtk_text_iter_next_char (&iter);
|
gtk_text_iter_forward_char (&iter);
|
||||||
|
|
||||||
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
||||||
|
|
||||||
@ -359,14 +359,14 @@ run_tests (GtkTextBuffer *buffer)
|
|||||||
|
|
||||||
if (i > 0)
|
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");
|
g_error ("iterators ran out before char indexes");
|
||||||
|
|
||||||
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
gtk_text_buffer_move_mark (buffer, bar_mark, &iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gtk_text_iter_prev_char (&iter))
|
if (gtk_text_iter_backward_char (&iter))
|
||||||
g_error ("went backward from 0?");
|
g_error ("went backward from 0?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user