@@ -212,7 +212,10 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
212212 private unowned Code .Widgets .SourceList .Item ? find_path (
213213 Code .Widgets .SourceList .ExpandableItem list ,
214214 string path ,
215- bool expand = false ) {
215+ bool expand = false ,
216+ GLib .File ? target_file = null ) {
217+
218+ var target = target_file ?? GLib . File . new_for_path (path);
216219
217220 foreach (var item in list. children) {
218221 if (item is Item ) {
@@ -221,22 +224,23 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
221224 return (! )item;
222225 }
223226
224- if (item is Code . Widgets . SourceList . ExpandableItem ) {
225- var expander = item as Code . Widgets . SourceList . ExpandableItem ;
226- if (! path. has_prefix (code_item. path)) {
227+ if (item is FolderItem ) {
228+ var folder = item as FolderItem ;
229+ var folder_root = folder. file. file;
230+ if (folder_root. get_relative_path (target) == null ) {
227231 continue ;
228232 }
229233
230- if (! expander . expanded) {
234+ if (! folder . expanded) {
231235 if (expand) {
232- (( FolderItem )expander) . load_children (); // Synchronous
233- expander . expanded = true ;
236+ folder . load_children (); // Synchronous
237+ folder . expanded = true ;
234238 } else {
235239 continue ;
236240 }
237241 }
238242
239- unowned var recurse_item = find_path (expander , path, expand);
243+ unowned var recurse_item = find_path (folder , path, expand, target );
240244 if (recurse_item != null ) {
241245 return recurse_item;
242246 }
0 commit comments