summaryrefslogtreecommitdiff
path: root/tests/testtext.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-09-07 21:39:18 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-09-07 21:39:18 +0000
commitf1427cd9bb2d980af72b98d6f1f1d835190edc52 (patch)
tree1c775b3cbc4f7a5857c52542013072866089c53d /tests/testtext.c
parentd8e3d58d421fb18175f5913b5e3ad7b83b3fa49c (diff)
downloadgtk+-f1427cd9bb2d980af72b98d6f1f1d835190edc52.tar.gz
update adjustments after validating destination yrange; fixes #53918 (This
2001-09-07 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_flush_scroll): update adjustments after validating destination yrange; fixes #53918 (This may cause other issues, but I hope it won't) 2001-09-05 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (_gtk_text_btree_delete): when merging end line into start line, update the character counts in parent nodes; caused a bug when end and start line had different parent nodes. 2001-08-30 Havoc Pennington <hp@redhat.com> * gtk/gtktexttag.c (_gtk_text_attributes_fill_from_tags): add assertion that tag is in a table
Diffstat (limited to 'tests/testtext.c')
-rw-r--r--tests/testtext.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/testtext.c b/tests/testtext.c
index 8a348be36d..516128b65e 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -191,6 +191,9 @@ msgbox_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer data)
return FALSE;
}
+/* Don't copy this example, it's all crack-smoking - you can just use
+ * GtkMessageDialog now
+ */
gint
msgbox_run (GtkWindow *parent,
const char *message,
@@ -842,6 +845,35 @@ do_example (gpointer callback_data,
view_add_example_widgets (new_view);
}
+
+static void
+do_insert_and_scroll (gpointer callback_data,
+ guint callback_action,
+ GtkWidget *widget)
+{
+ View *view = view_from_widget (widget);
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+ GtkTextMark *mark;
+
+ buffer = view->buffer->buffer;
+
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
+ mark = gtk_text_buffer_create_mark (buffer, NULL, &end, /* right grav */ FALSE);
+
+ gtk_text_iter_backward_char (&end);
+ gtk_text_buffer_insert (buffer, &end,
+ "Hello this is multiple lines of text\n"
+ "Line 1\n" "Line 2\n"
+ "Line 3\n" "Line 4\n"
+ "Line 5\n",
+ -1);
+
+ gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view->text_view), mark,
+ 0, TRUE, 0.0, 1.0);
+ gtk_text_buffer_delete_mark (buffer, mark);
+}
+
static void
do_wrap_changed (gpointer callback_data,
guint callback_action,
@@ -1268,6 +1300,7 @@ static GtkItemFactoryEntry menu_items[] =
{ "/Attributes/Properties", NULL, do_properties, 0, NULL },
{ "/_Test", NULL, 0, 0, "<Branch>" },
{ "/Test/_Example", NULL, do_example, 0, NULL },
+ { "/Test/_Insert and scroll", NULL, do_insert_and_scroll, 0, NULL },
};
static gboolean