From f197b23980c46b768190d7ac3054a823933c3871 Mon Sep 17 00:00:00 2001
From: Sergios - Anestis Kefalidis <sergioskefalidis@gmail.com>
Date: Wed, 30 Mar 2022 19:00:11 +0300
Subject: [PATCH] Recursive search: Do not search when the search query is
 empty.

An empty search query would start adding all the files to the current view, which in turn could cause a significant slowdown.
---
 thunar/thunar-list-model.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index 8416739bc..125bace04 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -2381,8 +2381,10 @@ thunar_list_model_set_folder (ThunarListModel *store,
     {
       g_object_ref (G_OBJECT (folder));
 
-      /* get the already loaded files or search for files matching the search_query */
-      if (search_query == NULL)
+      /* get the already loaded files or search for files matching the search_query
+       * don't start searching if the query is empty, that would be a waste of resources
+       */
+      if (search_query == NULL || strlen (search_query) == 0)
         {
           files = thunar_folder_get_files (folder);
         }
-- 
GitLab