summaryrefslogtreecommitdiff
path: root/src/search.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-04 20:05:37 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-04 20:05:37 +0100
commit6c898ad82994fcaa7fe64cfe10774994a4587ca7 (patch)
tree6a0f660db46ff2576a3ece6106a9eb2fcdca00bb /src/search.cpp
parent69ab71a50010a0442bcb94bc810f5bda5166c63c (diff)
show all files when no search query given
Diffstat (limited to 'src/search.cpp')
-rw-r--r--src/search.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/search.cpp b/src/search.cpp
index 5be2b33..dc0534a 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -297,6 +297,7 @@ static void _ts_search_file(ts_found_file *ref, ts_file_content content, ts_sear
static void *_ts_search_thread(void *args)
{
ts_search_result *new_result = (ts_search_result *)args;
+ if (new_result->search_text == nullptr) goto finish_early;
keep_going:;
while (new_result->file_list_read_cursor < new_result->files.length)
@@ -376,6 +377,10 @@ void ts_start_search(utf8_int8_t *path, utf8_int8_t *filter, utf8_int8_t *query)
snprintf(new_result->search_text, MAX_INPUT_LENGTH, "%s", query);
new_result->filters = ts_get_filters(filter);
+ if (utf8len(query) == 0) {
+ new_result->search_text = nullptr;
+ }
+
_ts_list_files(new_result);
for (int i = 0; i < new_result->max_ts_thread_count; i++)
{