From 0290d2bc845bbd6445d22176ceb88ca5a7dc3422 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 19 Mar 2013 13:20:24 +0100 Subject: [PATCH] Fix scrolling of Chat Box Seems the problem is that scroll_to_iter does not work until after some time, needed to calculate line heights. Use scroll_to_mark instead, after clumsily adding a text_mark. --- gtk/xoptions.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 0eb1658..7a03ffb 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -317,8 +317,13 @@ void ScrollToCursor (Option *opt, int caretPos) { static GtkTextIter iter; + static GtkTextMark *mark; + if(!mark) mark = gtk_text_mark_new(NULL, 0); gtk_text_buffer_get_iter_at_offset((GtkTextBuffer *) opt->handle, &iter, caretPos); - gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_add_mark((GtkTextBuffer *) opt->handle, mark, &iter); + gtk_text_view_scroll_to_mark((GtkTextView *) opt->textValue, mark, 0.0, 0, 0.5, 0.5); +// gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_delete_mark((GtkTextBuffer *) opt->handle, mark); } int -- 1.7.0.4