diff --git a/4coder_default_framework_variables.cpp b/4coder_default_framework_variables.cpp index 5ff9b6a0..25508f5c 100644 --- a/4coder_default_framework_variables.cpp +++ b/4coder_default_framework_variables.cpp @@ -57,7 +57,7 @@ enum{ FCoderMode_Original = 0, FCoderMode_NotepadLike = 1, }; -static int32_t fcoder_mode = FCoderMode_NotepadLike; +static int32_t fcoder_mode = FCoderMode_Original; static ID_Line_Column_Jump_Location prev_location = {0}; diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 5f561f4c..0394c0ce 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -495,23 +495,39 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ memcpy(conflict->unique_name_in_out, conflict->base_name, len); if (conflict->file_name != 0){ + char uniqueifier_space[256]; + String uniqueifier = make_fixed_width_string(uniqueifier_space); + String s_file_name = make_string(conflict->file_name, conflict->file_name_len); s_file_name = path_of_directory(s_file_name); - s_file_name.size -= 1; - char *end = s_file_name.str + s_file_name.size; - for (int32_t j = 0; j < x; ++j){ - s_file_name = path_of_directory(s_file_name); - if (j + 1 < x){ - s_file_name.size -= 1; + if (s_file_name.size > 0){ + s_file_name.size -= 1; + char *end = s_file_name.str + s_file_name.size; + bool32 past_the_end = false; + for (int32_t j = 0; j < x; ++j){ + s_file_name = path_of_directory(s_file_name); + if (j + 1 < x){ + s_file_name.size -= 1; + } + if (s_file_name.size <= 0){ + if (j + 1 < x){ + past_the_end = true; + } + s_file_name.size = 0; + break; + } } - if (s_file_name.size <= 0){ - s_file_name.size = 0; - break; + char *start = s_file_name.str + s_file_name.size; + + append(&uniqueifier, make_string(start, (int32_t)(end - start))); + if (past_the_end){ + append(&uniqueifier, "~"); + append_int_to_str(&uniqueifier, i); } } - char *start = s_file_name.str + s_file_name.size; - - String uniqueifier = make_string(start, (int32_t)(end - start)); + else{ + append_int_to_str(&uniqueifier, i); + } String builder = make_string_cap(conflict->unique_name_in_out, conflict->unique_name_len_in_out, diff --git a/todo.txt b/todo.txt index e94855fa..024c2c71 100644 --- a/todo.txt +++ b/todo.txt @@ -13,12 +13,14 @@ [x] Crash when freeing marker object without visuals [x] High CPU usage in listers (endless animation bug) [x] Panel resizing doesn't work + [] On windows file lister: /foo/bar.txt [] Notepad like mode clicking to new view doesn't snap the mark [] Notepad like mode replacing text with cursor at end of selection in middle of long file [] Tab when no valid completions in open file lister [] Graphics problem (fonts not rendering) [] Texture binding changes too often problem. [] SSHFS segfault on linux + [] New file when the file is already open Repro Needed { [] pasting long comment at top of code files doesn't always parse right away???