Index: gtktextbtree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextbtree.c,v
retrieving revision 1.76.2.3
diff -u -p -r1.76.2.3 gtktextbtree.c
--- gtktextbtree.c	2 Nov 2005 05:11:13 -0000	1.76.2.3
+++ gtktextbtree.c	17 Nov 2005 22:21:16 -0000
@@ -4159,7 +4159,12 @@ _gtk_text_line_char_to_byte_offsets (Gtk
     {
       const char *p;
 
-      p = g_utf8_offset_to_pointer (seg->body.chars, offset);
+      /* if in the last fourth of the segment walk backwards */
+      if (seg->char_count - offset < seg->char_count / 4)
+        p = g_utf8_offset_to_pointer (seg->body.chars + seg->byte_count, 
+                                      offset - seg->char_count);
+      else
+        p = g_utf8_offset_to_pointer (seg->body.chars, offset);
 
       *seg_byte_offset = p - seg->body.chars;
 
Index: gtktextiter.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextiter.c,v
retrieving revision 1.85.2.2
diff -u -p -r1.85.2.2 gtktextiter.c
--- gtktextiter.c	14 Nov 2005 04:24:02 -0000	1.85.2.2
+++ gtktextiter.c	17 Nov 2005 22:21:21 -0000
@@ -2389,23 +2389,25 @@ gtk_text_iter_backward_chars (GtkTextIte
       g_assert (real->segment->char_count > 0);
       g_assert (real->segment->type == &gtk_text_char_type);
 
-      real->segment_char_offset -= count;
-      g_assert (real->segment_char_offset >= 0);
-
       if (real->line_byte_offset >= 0)
         {
           const char *p;
           gint new_byte_offset;
-          gint i;
 
-          p = g_utf8_offset_to_pointer (real->segment->body.chars,
-                                        real->segment_char_offset);
+          /* if in the last fourth of the segment walk backwards */
+          if (count < real->segment_char_offset / 4)
+            p = g_utf8_offset_to_pointer (real->segment->body.chars + real->segment_byte_offset, 
+                                          -count);
+          else
+            p = g_utf8_offset_to_pointer (real->segment->body.chars,
+                                          real->segment_char_offset - count);
 
           new_byte_offset = p - real->segment->body.chars;
           real->line_byte_offset -= (real->segment_byte_offset - new_byte_offset);
           real->segment_byte_offset = new_byte_offset;
         }
 
+      real->segment_char_offset -= count;
       real->line_char_offset -= count;
 
       adjust_char_index (real, 0 - count);
