summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-08 22:16:31 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-08 22:16:31 +0100
commit15dd612705a2054cacfb794f5d1662f38316bbdd (patch)
tree62a146ac5b8e9c83b71aba43cd629bc55b35328d
parentdc5396903791c1b2a1808e724d9b6cf07d7604a7 (diff)
max path length for windows
-rw-r--r--.gitignore2
-rw-r--r--.vscode/settings.json10
-rw-r--r--build_linux.sh2
-rw-r--r--imgui.ini12
-rw-r--r--src/config.h5
-rw-r--r--src/search.cpp3
6 files changed, 9 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index c3d0335..54bb451 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
bin/*
TODO
-.vscode \ No newline at end of file
+.vscode/* \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index e0ea277..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "files.associations": {
- "xhash": "cpp",
- "chrono": "cpp",
- "system_error": "cpp",
- "xlocale": "cpp",
- "stack": "cpp",
- "list": "cpp"
- }
-} \ No newline at end of file
diff --git a/build_linux.sh b/build_linux.sh
index fee4b3b..9107a65 100644
--- a/build_linux.sh
+++ b/build_linux.sh
@@ -5,7 +5,7 @@ OUT_DIR="bin/debug"
mkdir -p "bin/debug"
ld -r -b binary -o bin/debug/data.obj LICENSE misc/logo_64.png imgui/LICENSE imspinner/LICENSE imfiledialog/LICENSE misc/search.png misc/folder.png
-g++ -std=c++17 -w -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/*.cpp imfiledialog/*.cpp src/linux/*.cpp bin/debug/data.obj -Iimgui -Iimgui/backends -Isrc -Isrc/linux -pthread -ldl -lglfw -lGLU -lGL
+g++ -m64 -std=c++17 -w -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/*.cpp imfiledialog/*.cpp src/linux/*.cpp bin/debug/data.obj -Iimgui -Iimgui/backends -Isrc -Isrc/linux -pthread -ldl -lglfw -lGLU -lGL
./bin/debug/text-search \ No newline at end of file
diff --git a/imgui.ini b/imgui.ini
deleted file mode 100644
index a45230f..0000000
--- a/imgui.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[Window][Debug##Default]
-Pos=60,60
-Size=400,400
-
-[Window][Dear ImGui Demo]
-Pos=580,49
-Size=550,680
-
-[Window][Hello, world!]
-Pos=60,60
-Size=339,180
-
diff --git a/src/config.h b/src/config.h
index 8e610f5..5255c1a 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1,6 +1,11 @@
#pragma once
+#if defined(_WIN32)
+#define MAX_INPUT_LENGTH 32767
+#elif defined(__linux__)
#define MAX_INPUT_LENGTH 4096
+#endif
+
#define MAX_ERROR_MESSAGE_LENGTH (MAX_INPUT_LENGTH)
#define FILE_RESERVE_COUNT 1000
#define ERROR_RESERVE_COUNT 100
diff --git a/src/search.cpp b/src/search.cpp
index 8e7b8a1..ed6c1ee 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -88,7 +88,7 @@ ts_search_result *ts_create_empty_search_result()
new_result_buffer->file_count = 0;
new_result_buffer->cancel_search = false;
new_result_buffer->max_file_size = megabytes(1000);
- new_result_buffer->memory = ts_memory_bucket_init(megabytes(1));
+ new_result_buffer->memory = ts_memory_bucket_init(megabytes(10));
new_result_buffer->prev_result = current_search_result;
new_result_buffer->timestamp = ts_platform_get_time();
@@ -262,6 +262,7 @@ static void _ts_search_file(ts_found_file *ref, ts_file_content content, ts_sear
file_match.word_match_offset = m->word_offset;
file_match.word_match_length = m->word_match_len;
file_match.line_info = (char *)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH);
+ memset(file_match.line_info, 0, MAX_INPUT_LENGTH);
// Trim some text infront of match.
int text_pad_lr = 35;