From 394ae506bab4781d0c1dab3408d358c6684d0e83 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 25 Jul 2002 02:52:44 +0000 Subject: [PATCH] Apply patch from Gustavo Giraldez for bug #78513 2002-07-24 Havoc Pennington * gtk/gtktextview.c: Apply patch from Gustavo Giraldez for bug #78513 --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktextview.c | 34 +++++++++++++++++++++++----------- 7 files changed, 53 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 749513010d..a42f584724 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 749513010d..a42f584724 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 749513010d..a42f584724 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 749513010d..a42f584724 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 749513010d..a42f584724 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 749513010d..a42f584724 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2002-07-24 Havoc Pennington + + * gtk/gtktextview.c: Apply patch from Gustavo + Giraldez for bug #78513 + Wed Jul 24 16:43:49 2002 Owen Taylor * gtk/gtkrc.c docs/references/tmpl/gtkrc.sgml: Don't use diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 7ef9788971..0314098802 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1512,6 +1512,16 @@ free_pending_scroll (GtkTextPendingScroll *scroll) g_free (scroll); } +static void +cancel_pending_scroll (GtkTextView *text_view) +{ + if (text_view->pending_scroll) + { + free_pending_scroll (text_view->pending_scroll); + text_view->pending_scroll = NULL; + } +} + static void gtk_text_view_queue_scroll (GtkTextView *text_view, GtkTextMark *mark, @@ -1541,8 +1551,7 @@ gtk_text_view_queue_scroll (GtkTextView *text_view, g_object_ref (G_OBJECT (scroll->mark)); - if (text_view->pending_scroll) - free_pending_scroll (text_view->pending_scroll); + cancel_pending_scroll (text_view); text_view->pending_scroll = scroll; } @@ -2428,11 +2437,7 @@ gtk_text_view_finalize (GObject *object) gtk_text_view_destroy_layout (text_view); gtk_text_view_set_buffer (text_view, NULL); - if (text_view->pending_scroll) - { - free_pending_scroll (text_view->pending_scroll); - text_view->pending_scroll = NULL; - } + cancel_pending_scroll (text_view); if (text_view->tabs) pango_tab_array_free (text_view->tabs); @@ -3052,11 +3057,14 @@ gtk_text_view_flush_first_validate (GtkTextView *text_view) } else { - /* scroll to any marks, if that's pending. This can - * jump us to the validation codepath used for scrolling - * onscreen, if so we bail out. + /* scroll to any marks, if that's pending. This can jump us to + * the validation codepath used for scrolling onscreen, if so we + * bail out. It won't jump if already in that codepath since + * value_changed is not recursive, so also validate if + * necessary. */ - if (!gtk_text_view_flush_scroll (text_view)) + if (!gtk_text_view_flush_scroll (text_view) || + !text_view->onscreen_validated) gtk_text_view_validate_onscreen (text_view); DV(g_print(">Leaving first validate idle ("G_STRLOC")\n")); @@ -4628,6 +4636,8 @@ gtk_text_view_scroll_pages (GtkTextView *text_view, g_return_if_fail (text_view->vadjustment != NULL); + cancel_pending_scroll (text_view); + adj = text_view->vadjustment; /* Validate the region that will be brought into view by the cursor motion @@ -4702,6 +4712,8 @@ gtk_text_view_scroll_hpages (GtkTextView *text_view, g_return_if_fail (text_view->hadjustment != NULL); + cancel_pending_scroll (text_view); + adj = text_view->hadjustment; /* Validate the line that we're moving within.