Scroll to cursor when the document is loaded.

This should fix bug #598082
parent 6f35998c
......@@ -1025,6 +1025,9 @@ document_loaded (GeditDocument *document,
mime);
g_free (mime);
/* Scroll to the cursor when the document is loaded */
gedit_view_scroll_to_cursor (GEDIT_VIEW (tab->priv->view));
all_documents = gedit_app_get_documents (gedit_app_get_default ());
for (l = all_documents; l != NULL; l = g_list_next (l))
......
......@@ -69,9 +69,6 @@ enum
struct _GeditViewPrivate
{
/* idle hack to make open-at-line work */
guint scroll_idle;
SearchMode search_mode;
GtkTextIter start_search_iter;
......@@ -289,15 +286,6 @@ gedit_view_class_init (GeditViewClass *klass)
G_TYPE_INT, 1);
}
static gboolean
scroll_to_cursor_on_init (GeditView *view)
{
gedit_view_scroll_to_cursor (view);
view->priv->scroll_idle = 0;
return FALSE;
}
static void
current_buffer_removed (GeditView *view)
{
......@@ -384,16 +372,7 @@ gedit_view_init (GeditView *view)
"indent_on_tab", TRUE,
NULL);
/* Make sure that the view is scrolled to the cursor so
* that "gedit +100 foo.txt" works.
* We would like to this on the first expose handler so that
* it would look instantaneous, but this isn't currently
* possible: see bug #172277 and bug #311728.
* So we need to do this in an idle handler.
*/
view->priv->scroll_idle = g_idle_add ((GSourceFunc) scroll_to_cursor_on_init, view);
view->priv->typeselect_flush_timeout = 0;
view->priv->typeselect_flush_timeout = 0;
view->priv->wrap_around = TRUE;
/* Drag and drop support */
......@@ -416,12 +395,6 @@ gedit_view_destroy (GtkObject *object)
view = GEDIT_VIEW (object);
if (view->priv->scroll_idle > 0)
{
g_source_remove (view->priv->scroll_idle);
view->priv->scroll_idle = 0;
}
if (view->priv->search_window != NULL)
{
gtk_widget_destroy (view->priv->search_window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment