diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 14 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 14 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 14 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 14 | ||||
-rw-r--r-- | gtk/gtktextbtree.c | 13 | ||||
-rw-r--r-- | gtk/gtktextbtree.h | 4 | ||||
-rw-r--r-- | gtk/gtktextbuffer.c | 35 | ||||
-rw-r--r-- | gtk/gtktextbuffer.h | 5 |
9 files changed, 119 insertions, 8 deletions
@@ -1,3 +1,17 @@ +2003-01-06 Matthias Clasen <maclas@gmx.de> + + Implement a utility function proposed in #102534: + + * gtk/gtktextbtree.h: + * gtk/gtktextbtree.c (_gtk_text_btree_select_range): New function. + (_gtk_text_btree_place_cursor): Now a simple wrapper around + _gtk_text_btree_select_range(). + + * gtk/gtktextbuffer.h: + * gtk/gtktextbuffer.c (gtk_text_buffer_select_range): New function. + (gtk_text_buffer_place_cursor): Now a simple wrapper around + gtk_text_buffer_select_range(). + 2003-01-05 Havoc Pennington <hp@pobox.com> * configure.in: fix a stray bracket that was breaking the build diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 85a1a5f79e..41770be8ff 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +2003-01-06 Matthias Clasen <maclas@gmx.de> + + Implement a utility function proposed in #102534: + + * gtk/gtktextbtree.h: + * gtk/gtktextbtree.c (_gtk_text_btree_select_range): New function. + (_gtk_text_btree_place_cursor): Now a simple wrapper around + _gtk_text_btree_select_range(). + + * gtk/gtktextbuffer.h: + * gtk/gtktextbuffer.c (gtk_text_buffer_select_range): New function. + (gtk_text_buffer_place_cursor): Now a simple wrapper around + gtk_text_buffer_select_range(). + 2003-01-05 Havoc Pennington <hp@pobox.com> * configure.in: fix a stray bracket that was breaking the build diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 85a1a5f79e..41770be8ff 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +2003-01-06 Matthias Clasen <maclas@gmx.de> + + Implement a utility function proposed in #102534: + + * gtk/gtktextbtree.h: + * gtk/gtktextbtree.c (_gtk_text_btree_select_range): New function. + (_gtk_text_btree_place_cursor): Now a simple wrapper around + _gtk_text_btree_select_range(). + + * gtk/gtktextbuffer.h: + * gtk/gtktextbuffer.c (gtk_text_buffer_select_range): New function. + (gtk_text_buffer_place_cursor): Now a simple wrapper around + gtk_text_buffer_select_range(). + 2003-01-05 Havoc Pennington <hp@pobox.com> * configure.in: fix a stray bracket that was breaking the build diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 85a1a5f79e..41770be8ff 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +2003-01-06 Matthias Clasen <maclas@gmx.de> + + Implement a utility function proposed in #102534: + + * gtk/gtktextbtree.h: + * gtk/gtktextbtree.c (_gtk_text_btree_select_range): New function. + (_gtk_text_btree_place_cursor): Now a simple wrapper around + _gtk_text_btree_select_range(). + + * gtk/gtktextbuffer.h: + * gtk/gtktextbuffer.c (gtk_text_buffer_select_range): New function. + (gtk_text_buffer_place_cursor): Now a simple wrapper around + gtk_text_buffer_select_range(). + 2003-01-05 Havoc Pennington <hp@pobox.com> * configure.in: fix a stray bracket that was breaking the build diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 85a1a5f79e..41770be8ff 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +2003-01-06 Matthias Clasen <maclas@gmx.de> + + Implement a utility function proposed in #102534: + + * gtk/gtktextbtree.h: + * gtk/gtktextbtree.c (_gtk_text_btree_select_range): New function. + (_gtk_text_btree_place_cursor): Now a simple wrapper around + _gtk_text_btree_select_range(). + + * gtk/gtktextbuffer.h: + * gtk/gtktextbuffer.c (gtk_text_buffer_select_range): New function. + (gtk_text_buffer_place_cursor): Now a simple wrapper around + gtk_text_buffer_select_range(). + 2003-01-05 Havoc Pennington <hp@pobox.com> * configure.in: fix a stray bracket that was breaking the build diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index 3fa504d2cb..dd180a2275 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -2656,6 +2656,14 @@ void _gtk_text_btree_place_cursor (GtkTextBTree *tree, const GtkTextIter *iter) { + _gtk_text_btree_select_range (tree, iter, iter); +} + +void +_gtk_text_btree_select_range (GtkTextBTree *tree, + const GtkTextIter *ins, + const GtkTextIter *bound) +{ GtkTextIter start, end; if (_gtk_text_btree_get_selection_bounds (tree, &start, &end)) @@ -2663,11 +2671,12 @@ _gtk_text_btree_place_cursor (GtkTextBTree *tree, /* Move insert AND selection_bound before we redisplay */ real_set_mark (tree, tree->insert_mark, - "insert", FALSE, iter, TRUE, FALSE); + "insert", FALSE, ins, TRUE, FALSE); real_set_mark (tree, tree->selection_bound_mark, - "selection_bound", FALSE, iter, TRUE, FALSE); + "selection_bound", FALSE, bound, TRUE, FALSE); } + void _gtk_text_btree_remove_mark_by_name (GtkTextBTree *tree, const gchar *name) diff --git a/gtk/gtktextbtree.h b/gtk/gtktextbtree.h index d3553624eb..28fe390f0c 100644 --- a/gtk/gtktextbtree.h +++ b/gtk/gtktextbtree.h @@ -173,6 +173,10 @@ gboolean _gtk_text_btree_get_selection_bounds (GtkTextBTree GtkTextIter *end); void _gtk_text_btree_place_cursor (GtkTextBTree *tree, const GtkTextIter *where); +void _gtk_text_btree_select_range (GtkTextBTree *tree, + const GtkTextIter *ins, + const GtkTextIter +*bound); gboolean _gtk_text_btree_mark_is_insert (GtkTextBTree *tree, GtkTextMark *segment); gboolean _gtk_text_btree_mark_is_selection_bound (GtkTextBTree *tree, diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index d5327d0aae..1f49807f75 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -2009,17 +2009,42 @@ void gtk_text_buffer_place_cursor (GtkTextBuffer *buffer, const GtkTextIter *where) { - GtkTextIter real; + gtk_text_buffer_select_range (buffer, where, where); +} + + +/** + * gtk_text_buffer_select_range: + * @buffer: a #GtkTextBuffer + * @ins: where to put the "insert" mark + * @bound: where to put the "selection_bound" mark + * + * This function moves the "insert" and "selection_bound" marks + * simultaneously. If you move them in two steps + * with gtk_text_buffer_move_mark(), you will temporarily select a + * region in between their old and new locations, which can be pretty + * inefficient since the temporarily-selected region will force stuff + * to be recalculated. This function moves them as a unit, which can + * be optimized. + **/ +void +gtk_text_buffer_select_range (GtkTextBuffer *buffer, + const GtkTextIter *ins, + const GtkTextIter *bound) +{ + GtkTextIter real_ins; + GtkTextIter real_bound; g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer)); - real = *where; + real_ins = *ins; + real_bound = *bound; - _gtk_text_btree_place_cursor (get_btree (buffer), &real); - gtk_text_buffer_mark_set (buffer, &real, + _gtk_text_btree_select_range (get_btree (buffer), &real_ins, &real_bound); + gtk_text_buffer_mark_set (buffer, &real_ins, gtk_text_buffer_get_mark (buffer, "insert")); - gtk_text_buffer_mark_set (buffer, &real, + gtk_text_buffer_mark_set (buffer, &real_bound, gtk_text_buffer_get_mark (buffer, "selection_bound")); } diff --git a/gtk/gtktextbuffer.h b/gtk/gtktextbuffer.h index 0a5af63138..6f4a4728ca 100644 --- a/gtk/gtktextbuffer.h +++ b/gtk/gtktextbuffer.h @@ -253,9 +253,12 @@ void gtk_text_buffer_delete_mark_by_name (GtkTextBuffer *buffer, GtkTextMark* gtk_text_buffer_get_insert (GtkTextBuffer *buffer); GtkTextMark* gtk_text_buffer_get_selection_bound (GtkTextBuffer *buffer); -/* efficiently move insert and selection_bound to same location */ +/* efficiently move insert and selection_bound at the same time */ void gtk_text_buffer_place_cursor (GtkTextBuffer *buffer, const GtkTextIter *where); +void gtk_text_buffer_select_range (GtkTextBuffer *buffer, + const GtkTextIter *ins, + const GtkTextIter *bound); |