From fdf36e7e9192e1a180c57d7f54aa13b5b9da8fb5 Mon Sep 17 00:00:00 2001 From: Colin Kiama Date: Tue, 21 Nov 2023 11:39:04 +0000 Subject: [PATCH 1/2] Folder search is now scoped to selected folder --- src/FolderManager/FileView.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FolderManager/FileView.vala b/src/FolderManager/FileView.vala index 2e3ae4a33c..65fb451237 100644 --- a/src/FolderManager/FileView.vala +++ b/src/FolderManager/FileView.vala @@ -193,7 +193,11 @@ public class Scratch.FolderManager.FileView : Granite.Widgets.SourceList, Code.P if (item_for_path != null) { var search_root = item_for_path.get_root_folder (); if (search_root is ProjectFolderItem) { - search_root.global_search (search_root.file.file, term); + GLib.File start_folder = (item_for_path is FolderItem) + ? item_for_path.file.file + : search_root.file.file; + + search_root.global_search (start_folder, term); } } } From fd4859e608da9b682ef18afcd99a99eb6bf620a5 Mon Sep 17 00:00:00 2001 From: Colin Kiama Date: Tue, 21 Nov 2023 12:46:34 +0000 Subject: [PATCH 2/2] Fixes #1198 --- src/FolderManager/FileView.vala | 3 ++- src/FolderManager/ProjectFolderItem.vala | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/FolderManager/FileView.vala b/src/FolderManager/FileView.vala index 65fb451237..5b65ac2669 100644 --- a/src/FolderManager/FileView.vala +++ b/src/FolderManager/FileView.vala @@ -197,7 +197,8 @@ public class Scratch.FolderManager.FileView : Granite.Widgets.SourceList, Code.P ? item_for_path.file.file : search_root.file.file; - search_root.global_search (start_folder, term); + bool is_explicit = !(item_for_path is ProjectFolderItem); + search_root.global_search (start_folder, term, is_explicit); } } } diff --git a/src/FolderManager/ProjectFolderItem.vala b/src/FolderManager/ProjectFolderItem.vala index cc4dca33cc..247b0803c9 100644 --- a/src/FolderManager/ProjectFolderItem.vala +++ b/src/FolderManager/ProjectFolderItem.vala @@ -323,7 +323,11 @@ namespace Scratch.FolderManager { return is_git_repo ? monitored_repo.is_valid_new_local_branch_name (new_name) : false; } - public void global_search (GLib.File start_folder = this.file.file, string? term = null) { + public void global_search ( + GLib.File start_folder = this.file.file, + string? term = null, + bool is_explicit = false + ) { /* For now set all options to the most inclusive (except case). * The ability to set these in the dialog (or by parameter) may be added later. */ string? search_term = null; @@ -410,7 +414,7 @@ namespace Scratch.FolderManager { remove_all_badges (); collapse_all (); - if (monitored_repo != null) { + if (monitored_repo != null && !is_explicit) { try { monitored_repo.git_repo.file_status_foreach (status_options, (rel_path, status) => { var target = file.file.resolve_relative_path (rel_path);