forked from AuroraMiddleware/gtk
Replace manual offset calculations by g_utf8_offset_to_pointer().
2005-11-02 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets): * gtk/gtktextiter.c (gtk_text_iter_backward_chars): Replace manual offset calculations by g_utf8_offset_to_pointer(). (#320360, Paolo Borelli)
This commit is contained in:
parent
2b8bac8304
commit
6002bc6582
@ -1,3 +1,10 @@
|
||||
2005-11-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets):
|
||||
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): Replace
|
||||
manual offset calculations by g_utf8_offset_to_pointer().
|
||||
(#320360, Paolo Borelli)
|
||||
|
||||
Tue Nov 1 16:18:24 2005 Tim Janik <timj@imendio.com>
|
||||
|
||||
* gtk/gtkrbtree.[hc]: get rid of GAllocator usage, allocate and free
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-11-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets):
|
||||
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): Replace
|
||||
manual offset calculations by g_utf8_offset_to_pointer().
|
||||
(#320360, Paolo Borelli)
|
||||
|
||||
Tue Nov 1 16:18:24 2005 Tim Janik <timj@imendio.com>
|
||||
|
||||
* gtk/gtkrbtree.[hc]: get rid of GAllocator usage, allocate and free
|
||||
|
@ -4144,16 +4144,11 @@ _gtk_text_line_char_to_byte_offsets (GtkTextLine *line,
|
||||
|
||||
if (seg->type == >k_text_char_type)
|
||||
{
|
||||
*seg_byte_offset = 0;
|
||||
while (offset > 0)
|
||||
{
|
||||
gint bytes;
|
||||
const char * start = seg->body.chars + *seg_byte_offset;
|
||||
const char *p;
|
||||
|
||||
bytes = g_utf8_next_char (start) - start;
|
||||
*seg_byte_offset += bytes;
|
||||
offset -= 1;
|
||||
}
|
||||
p = g_utf8_offset_to_pointer (seg->body.chars, offset);
|
||||
|
||||
*seg_byte_offset = p - seg->body.chars;
|
||||
|
||||
g_assert (*seg_byte_offset < seg->byte_count);
|
||||
|
||||
|
@ -2391,19 +2391,14 @@ gtk_text_iter_backward_chars (GtkTextIter *iter, gint count)
|
||||
|
||||
if (real->line_byte_offset >= 0)
|
||||
{
|
||||
const char *p;
|
||||
gint new_byte_offset;
|
||||
gint i;
|
||||
|
||||
new_byte_offset = 0;
|
||||
i = 0;
|
||||
while (i < real->segment_char_offset)
|
||||
{
|
||||
const char * start = real->segment->body.chars + new_byte_offset;
|
||||
new_byte_offset += g_utf8_next_char (start) - start;
|
||||
|
||||
++i;
|
||||
}
|
||||
p = g_utf8_offset_to_pointer (real->segment->body.chars,
|
||||
real->segment_char_offset);
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user