File thunar-1.8.4-tree-view-scroll.patch of Package thunar.11589
From 0735e5bb8dd3b8fbac13f1b4165e30e27cea643f Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Mon, 18 Mar 2019 23:02:01 +0100
Subject: tree view jumps (scrolls) when clicking on a directory (Bug #15174)
---
thunar/thunar-tree-view.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 3ac367e4..ed3410f6 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -2533,6 +2533,7 @@ THUNAR_THREADS_ENTER
gtk_tree_model_get_iter (GTK_TREE_MODEL (view->model), &iter, path);
gtk_tree_path_free (path);
+ path = NULL;
/* collect all ThunarFiles in the path of current_directory in a List. root is on the very left side */
for (file = view->current_directory; file != NULL; file = thunar_file_get_parent (file, NULL))
@@ -2581,11 +2582,11 @@ THUNAR_THREADS_ENTER
gtk_tree_model_get (GTK_TREE_MODEL (view->model), &child_iter, THUNAR_TREE_MODEL_COLUMN_FILE, &file_in_tree, -1);
if (file == file_in_tree)
{
+ if (path != NULL)
+ gtk_tree_path_free (path);
g_object_unref (file_in_tree);
+ /* always remember latest known path, so we can set the cursor to it */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (view->model), &child_iter);
- gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
- gtk_tree_path_free (path);
iter = child_iter; /* next tree level */
break;
}
@@ -2597,6 +2598,16 @@ THUNAR_THREADS_ENTER
}
}
+ if (path == NULL)
+ path = thunar_tree_view_get_preferred_toplevel_path (view, view->current_directory);
+
+ if (path != NULL)
+ {
+ gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+
/* tidy up */
for (lp = path_as_list; lp != NULL; lp = lp->next)
{
--
cgit v1.2.1