[gnome-builder/wip/chergert/layout] editor: more robust scrolling attempts
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/layout] editor: more robust scrolling attempts
- Date: Sat, 1 Jul 2017 00:51:50 +0000 (UTC)
commit d926e67378bfabeb14a7a5685ea294127e88356d
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 30 17:36:44 2017 -0700
editor: more robust scrolling attempts
This seems to be more reliable than stuff we've tried in the
past to get scrolling to work.
libide/editor/ide-editor-view.c | 2 +-
libide/sourceview/ide-source-view.c | 3 ++-
libide/sourceview/ide-source-view.h | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libide/editor/ide-editor-view.c b/libide/editor/ide-editor-view.c
index c564e00..407593e 100644
--- a/libide/editor/ide-editor-view.c
+++ b/libide/editor/ide-editor-view.c
@@ -549,5 +549,5 @@ ide_editor_view_scroll_to_line (IdeEditorView *self,
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (self->buffer), &iter, line);
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (self->buffer), &iter, &iter);
- ide_source_view_scroll_to_iter (self->source_view, &iter, 0.0, TRUE, 1.0, 0.5, FALSE);
+ ide_source_view_scroll_to_insert (self->source_view);
}
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 42bbf92..29af108 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -706,7 +706,7 @@ animate_shrink (IdeSourceView *self,
NULL);
}
-static void
+void
ide_source_view_scroll_to_insert (IdeSourceView *self)
{
GtkTextBuffer *buffer;
@@ -717,6 +717,7 @@ ide_source_view_scroll_to_insert (IdeSourceView *self)
g_assert (IDE_IS_SOURCE_VIEW (self));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self));
+ _ide_buffer_cancel_cursor_restore (IDE_BUFFER (buffer));
mark = gtk_text_buffer_get_insert (buffer);
ide_source_view_scroll_mark_onscreen (self, mark, TRUE, 0.5, 0.5);
diff --git a/libide/sourceview/ide-source-view.h b/libide/sourceview/ide-source-view.h
index 8d9842a..8b66765 100644
--- a/libide/sourceview/ide-source-view.h
+++ b/libide/sourceview/ide-source-view.h
@@ -431,6 +431,7 @@ void ide_source_view_scroll_to_iter (IdeSource
gdouble xalign,
gdouble yalign,
gboolean
animate_scroll);
+void ide_source_view_scroll_to_insert (IdeSourceView *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]