Fixed infinite loop in buffer name resolution

master
Allen Webster 2018-10-09 21:40:30 -07:00
parent 6eb6ff04b5
commit 9d68aeeac8
3 changed files with 31 additions and 13 deletions

View File

@ -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};

View File

@ -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);
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;
}
}
char *start = s_file_name.str + s_file_name.size;
String uniqueifier = make_string(start, (int32_t)(end - start));
append(&uniqueifier, make_string(start, (int32_t)(end - start)));
if (past_the_end){
append(&uniqueifier, "~");
append_int_to_str(&uniqueifier, i);
}
}
else{
append_int_to_str(&uniqueifier, i);
}
String builder = make_string_cap(conflict->unique_name_in_out,
conflict->unique_name_len_in_out,

View File

@ -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???