Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/FolderManager/FileView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
private unowned Code.Widgets.SourceList.Item? find_path (
Code.Widgets.SourceList.ExpandableItem list,
string path,
bool expand = false) {
bool expand = false,
GLib.File? target_file = null) {

var target = target_file ?? GLib.File.new_for_path (path);

foreach (var item in list.children) {
if (item is Item) {
Expand All @@ -221,22 +224,23 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
return (!)item;
}

if (item is Code.Widgets.SourceList.ExpandableItem) {
var expander = item as Code.Widgets.SourceList.ExpandableItem;
if (!path.has_prefix (code_item.path)) {
if (item is FolderItem) {
var folder = item as FolderItem;
var folder_root = folder.file.file;
if (folder_root.get_relative_path (target) == null) {
continue;
}

if (!expander.expanded) {
if (!folder.expanded) {
if (expand) {
((FolderItem)expander).load_children (); //Synchronous
expander.expanded = true;
folder.load_children (); //Synchronous
folder.expanded = true;
} else {
continue;
}
}

unowned var recurse_item = find_path (expander, path, expand);
unowned var recurse_item = find_path (folder, path, expand, target);
if (recurse_item != null) {
return recurse_item;
}
Expand Down
Loading