From 6c898ad82994fcaa7fe64cfe10774994a4587ca7 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Mon, 4 Mar 2024 20:05:37 +0100 Subject: show all files when no search query given --- src/search.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/search.cpp') 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++) { -- cgit v1.2.3-70-g09d2