forked from AuroraMiddleware/gtk
Speed up stepping backwards. (#320638, Larry Ewing, Paolo Borelli)
2005-12-12 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets): * gtk/gtktextiter.c (gtk_text_iter_backward_chars): Speed up stepping backwards. (#320638, Larry Ewing, Paolo Borelli)
This commit is contained in:
parent
dd3a8cd122
commit
104772f87a
@ -1,5 +1,9 @@
|
||||
2005-12-12 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets):
|
||||
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): Speed up
|
||||
stepping backwards. (#320638, Larry Ewing, Paolo Borelli)
|
||||
|
||||
* gtk/gtkicontheme.c (ensure_valid_themes): Only broadcast
|
||||
_GTK_LOAD_ICONTHEMES if we detect a real theme change, not
|
||||
upon initial theme load. (#323876, Peter Lund)
|
||||
|
@ -1,5 +1,9 @@
|
||||
2005-12-12 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtktextbtree.c (_gtk_text_line_char_to_byte_offsets):
|
||||
* gtk/gtktextiter.c (gtk_text_iter_backward_chars): Speed up
|
||||
stepping backwards. (#320638, Larry Ewing, Paolo Borelli)
|
||||
|
||||
* gtk/gtkicontheme.c (ensure_valid_themes): Only broadcast
|
||||
_GTK_LOAD_ICONTHEMES if we detect a real theme change, not
|
||||
upon initial theme load. (#323876, Peter Lund)
|
||||
|
@ -4146,6 +4146,11 @@ _gtk_text_line_char_to_byte_offsets (GtkTextLine *line,
|
||||
{
|
||||
const char *p;
|
||||
|
||||
/* 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;
|
||||
|
@ -2386,23 +2386,25 @@ gtk_text_iter_backward_chars (GtkTextIter *iter, gint count)
|
||||
g_assert (real->segment->char_count > 0);
|
||||
g_assert (real->segment->type == >k_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;
|
||||
|
||||
/* 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);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user