diff options
author | Havoc Pennington <hp@pobox.com> | 2000-09-30 17:08:25 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-09-30 17:08:25 +0000 |
commit | 632fda6f0bd578006226b29badcfb63729f5eba2 (patch) | |
tree | 3326ce59b9514267f898dbd4b1d7cd9f49517c7c /tests/testtext.c | |
parent | f717bda19732f874762f2c48521d8370f15bf3f0 (diff) | |
download | gtk+-632fda6f0bd578006226b29badcfb63729f5eba2.tar.gz |
Handle NULL start/end pointers
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
NULL start/end pointers
* gtk/gtktextbuffer.c: Write some docs
(gtk_text_buffer_get_selection_bounds): Allow start/end to be
NULL, so you can just check whether there's a selection.
* gtk/gtktextbtree.c (gtk_text_btree_remove_mark): No need to
cleanup_line or segments_changed ourselves, it gets done
in unlink_segment
* gtk/gtktextmark.h:
s/gtk_text_mark_deleted/gtk_text_mark_get_deleted/
* gtk/gtktextsegment.h: Clean up some indentation and naming mess
* gtk/gtktextmark.c: delete some more old Tk cruft
* gtk/gtktextbuffer.c (gtk_text_buffer_delete_mark): add ref to
mark before removing it, so we can emit MARK_DELETED with a valid
pointer.
(gtk_text_buffer_mark_set): hold ref across signal emission
* gtk/gtktextbtree.c (gtk_text_btree_remove_mark): improve
whining about attempts to delete special marks
* gtk/gtktextbuffer.c (_gtk_text_buffer_spew): Prepend with
underscore, since it's internal.
* gtk/gtktextbuffer.h: Remove find_string prototype, this is
now implemented in terms of iterators in gtktextiter.h
* gtk/gtktextbuffer.c (gtk_text_buffer_set_text):
New function, destructively sets contents of buffer. Also
a convenient way to clear the buffer by setting text to ""
* gtk/gtktextiter.c (gtk_text_iter_make_surreal): reformat
multiline string literal
* gtk/testtext.c (text_changed_callback): Redraw line numbers if
text changes.
* gtk/gtktextiter.c (forward_char): Return FALSE if new location
is not dereferenceable
(gtk_text_iter_forward_lines): fix return value
Diffstat (limited to 'tests/testtext.c')
-rw-r--r-- | tests/testtext.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/testtext.c b/tests/testtext.c index b787efe172..16e7172b76 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -1433,6 +1433,35 @@ cursor_set_callback (GtkTextBuffer *buffer, } } + +static void +text_changed_callback (GtkTextBuffer *buffer, + gpointer user_data) +{ + GtkTextView *text_view; + + /* Redraw line number windows if the buffer changes + * and the widget is mapped (windows may not exist otherwise) + */ + + text_view = GTK_TEXT_VIEW (user_data); + + if (GTK_WIDGET_MAPPED (text_view)) + { + GdkWindow *line_window; + + line_window = gtk_text_view_get_window (text_view, + GTK_TEXT_WINDOW_LEFT); + + gdk_window_invalidate_rect (line_window, NULL, FALSE); + + line_window = gtk_text_view_get_window (text_view, + GTK_TEXT_WINDOW_RIGHT); + + gdk_window_invalidate_rect (line_window, NULL, FALSE); + } +} + static gint tab_stops_expose (GtkWidget *widget, GdkEventExpose *event, @@ -1783,6 +1812,11 @@ create_view (Buffer *buffer) "expose_event", GTK_SIGNAL_FUNC (line_numbers_expose), NULL); + + gtk_signal_connect (GTK_OBJECT (view->buffer->buffer), + "changed", + GTK_SIGNAL_FUNC (text_changed_callback), + view->text_view); gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (sw), view->text_view); |