summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_win32.bat2
-rw-r--r--imgui/imgui_spectrum.cpp15
-rw-r--r--src/linux/main_linux.cpp1
-rw-r--r--src/main.cpp14
-rw-r--r--src/search.h1
-rw-r--r--src/windows/main_windows.cpp1
6 files changed, 27 insertions, 7 deletions
diff --git a/build_win32.bat b/build_win32.bat
index d16a7ca..c95f984 100644
--- a/build_win32.bat
+++ b/build_win32.bat
@@ -1,5 +1,3 @@
-@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
-set __VSCMD_ARG_no_logo=""
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@set OUT_DIR=bin\\debug
@set OUT_EXE=text-search
diff --git a/imgui/imgui_spectrum.cpp b/imgui/imgui_spectrum.cpp
index d7705f2..44d52c6 100644
--- a/imgui/imgui_spectrum.cpp
+++ b/imgui/imgui_spectrum.cpp
@@ -11,16 +11,23 @@ namespace ImGui {
ImFontConfig config;
config.MergeMode = true;
- static const ImWchar rr[] =
+ static const ImWchar arrow_r[] =
{
0x2192, 0x2193, // → character.
0,
};
+ static const ImWchar triangles[] =
+ {
+ 0x25B6, 0x25BC, // ▶ ▼ characters.
+ 0,
+ };
+
ImFontGlyphRangesBuilder builder;
ImVector<ImWchar> ranges;
builder.AddRanges(io.Fonts->GetGlyphRangesDefault());
- builder.AddRanges(rr);
+ builder.AddRanges(arrow_r);
+ builder.AddRanges(triangles);
builder.BuildRanges(&ranges);
ImFont* font = io.Fonts->AddFontFromMemoryCompressedTTF(
@@ -96,8 +103,8 @@ namespace ImGui {
colors[ImGuiCol_Border] = ColorConvertU32ToFloat4(Color(0xCCCCCC));
colors[ImGuiCol_MenuBarBg] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
colors[ImGuiCol_Header] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
- colors[ImGuiCol_HeaderHovered] = ColorConvertU32ToFloat4(Spectrum::GRAY200);
- colors[ImGuiCol_HeaderActive] = ColorConvertU32ToFloat4(Spectrum::GRAY200);
+ colors[ImGuiCol_HeaderHovered] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
+ colors[ImGuiCol_HeaderActive] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
colors[ImGuiCol_TableBorderStrong] = ColorConvertU32ToFloat4(Color(0xE7E7E7));
colors[ImGuiCol_TableBorderLight] = ColorConvertU32ToFloat4(Color(0xE7E7E7));
colors[ImGuiCol_TableHeaderBg] = ColorConvertU32ToFloat4(Spectrum::GRAY300);
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);