diff options
author | Thomas White <taw@physics.org> | 2020-08-12 16:59:27 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-08-12 16:59:27 +0200 |
commit | 8a4d8431d70785d3c016cec5ce1e4ac3b6a9dfd4 (patch) | |
tree | fd591f54167a2adb06efd52c45a7effe0c3cb78c | |
parent | ed8a379c85b67ece4c4918d3f324a95f1f20cb4a (diff) |
GUI: Better scrolling to end of text output
-rw-r--r-- | src/crystfel_gui.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 5e2eda26..a8f3be03 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -763,13 +763,19 @@ static void add_gui_message(enum log_msg_type type, const char *msg, { GtkTextBuffer *buf; GtkTextIter iter; + GtkTextMark *mark; struct crystfelproject *proj = vp; + buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(proj->report)); gtk_text_buffer_get_end_iter(buf, &iter); gtk_text_buffer_insert(buf, &iter, msg, -1); + + mark = gtk_text_mark_new(NULL, FALSE); gtk_text_buffer_get_end_iter(buf, &iter); - gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(proj->report), - &iter, 0.0, FALSE, 0.0, 0.0); + gtk_text_buffer_add_mark(buf, mark, &iter); + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(proj->report), + mark, 0.0, FALSE, 0.0, 0.0); + gtk_text_buffer_delete_mark(buf, mark); } |