diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-10 10:12:23 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-10 10:12:23 +0100 |
| commit | d671ea83612bcb683e675c041392922e66e57e58 (patch) | |
| tree | 11ebb222ef8007a53ba175e0994958c2a23e42c7 /src | |
| parent | b84007b0bc5fe286c96c675f5c2c210cccbc0490 (diff) | |
results are collapsable on per file
Diffstat (limited to 'src')
| -rw-r--r-- | src/linux/main_linux.cpp | 1 | ||||
| -rw-r--r-- | src/main.cpp | 14 | ||||
| -rw-r--r-- | src/search.h | 1 | ||||
| -rw-r--r-- | src/windows/main_windows.cpp | 1 |
4 files changed, 16 insertions, 1 deletions
diff --git a/src/linux/main_linux.cpp b/src/linux/main_linux.cpp index a4e30d3..c66f69b 100644 --- a/src/linux/main_linux.cpp +++ b/src/linux/main_linux.cpp @@ -269,6 +269,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) f->path = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); f->match_count = 0; f->error = 0; + f->collapsed = false; strcpy(f->path, complete_file_path); ts_mutex_lock(&result->files.mutex); diff --git a/src/main.cpp b/src/main.cpp index 5857192..32aca84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -246,7 +246,17 @@ void _ts_create_text_match_rows() { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::TableHeader(""); + + ImGui::SetCursorPosX(5); + ImGui::PushStyleColor(ImGuiCol_Text, {0,0,0,0.1f}); + ImGui::TableHeader(file->file->collapsed ? "▶" : "▼"); + + ImGui::SameLine(); + ImGui::Selectable("##nolabel", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap); + if (ImGui::IsItemClicked(ImGuiPopupFlags_MouseButtonLeft)) { + file->file->collapsed = !file->file->collapsed; + } + ImGui::PopStyleColor(); ImGui::TableNextColumn(); ImGui::TableHeader(file->file->path); @@ -256,6 +266,8 @@ void _ts_create_text_match_rows() { ImGui::TableHeader(match_info_txt); } + if (file->file->collapsed) continue; + char match_nr[20]; snprintf(match_nr, 20, "#%d", item+1); diff --git a/src/search.h b/src/search.h index 8bc6260..da11e29 100644 --- a/src/search.h +++ b/src/search.h @@ -10,6 +10,7 @@ typedef struct t_ts_found_file utf8_int8_t *path; int match_count; int error; + bool collapsed; } ts_found_file; typedef struct t_ts_search_result diff --git a/src/windows/main_windows.cpp b/src/windows/main_windows.cpp index c6db7a5..af64fc6 100644 --- a/src/windows/main_windows.cpp +++ b/src/windows/main_windows.cpp @@ -399,6 +399,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) f->path = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); f->match_count = 0; f->error = 0; + f->collapsed = false; WideCharToMultiByte(CP_UTF8,0,complete_file_path,-1,(LPSTR)f->path,MAX_INPUT_LENGTH, NULL, NULL); ts_mutex_lock(&result->files.mutex); |
