[gnome-builder] tree: Make sure that the focused row is changed too when selecting one



commit fcf6db45775fb79e98dd44388aecec3102c3bdca
Author: vanadiae <vanadiae35 gmail com>
Date:   Wed Jun 30 16:34:49 2021 +0200

    tree: Make sure that the focused row is changed too when selecting one
    
    Currently if the selected row and keyboard input focus is on row A, and
    one tries to right click row B to show the context menu, then it'll try
    to select the row with ide_tree_select(). But the keyboard focus isn't
    actually changed, only the tree model selected row, so pressing the down
    arrow won't select row C but it'll select row B instead, as the focus
    was still on row A although the selected row was B.
    
    So this commit makes the keyboard focus change at the same time as a row
    is selected, in ide_tree_select().

 src/libide/tree/ide-tree.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/src/libide/tree/ide-tree.c b/src/libide/tree/ide-tree.c
index 5c1c4e66b..4b6233593 100644
--- a/src/libide/tree/ide-tree.c
+++ b/src/libide/tree/ide-tree.c
@@ -117,6 +117,7 @@ ide_tree_select (IdeTree     *self,
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
   path = ide_tree_node_get_path (node);
   gtk_tree_selection_select_path (selection, path);
+  gtk_tree_view_set_cursor (GTK_TREE_VIEW (self), path, NULL, FALSE);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]