Fixed random crashes and misbehaviors
This commit is contained in:
parent
e977d1d312
commit
0bbafd636e
|
@ -1108,7 +1108,7 @@ get_view_prev__inner(Layout *layout, View *view){
|
|||
}
|
||||
}
|
||||
else{
|
||||
Panel *panel = layout_get_first_open_panel(layout);
|
||||
Panel *panel = layout_get_last_open_panel(layout);
|
||||
view = panel->view;
|
||||
}
|
||||
return(view);
|
||||
|
|
|
@ -123,6 +123,16 @@ layout_get_first_open_panel(Layout *layout){
|
|||
return(panel);
|
||||
}
|
||||
|
||||
internal Panel*
|
||||
layout_get_last_open_panel(Layout *layout){
|
||||
Panel *panel = CastFromMember(Panel, node, layout->open_panels.prev);
|
||||
if (panel != 0 && &panel->node == &layout->open_panels){
|
||||
panel = 0;
|
||||
}
|
||||
AssertImplies(panel != 0, panel->kind == PanelKind_Final);
|
||||
return(panel);
|
||||
}
|
||||
|
||||
internal Panel*
|
||||
layout_get_next_open_panel(Layout *layout, Panel *panel){
|
||||
panel = CastFromMember(Panel, node, panel->node.next);
|
||||
|
|
|
@ -1312,18 +1312,18 @@ CUSTOM_DOC("Queries the user for a new name and renames the file of the current
|
|||
bar.string = SCu8(name_space, (u64)0);
|
||||
bar.string_capacity = sizeof(name_space);
|
||||
if (query_user_string(app, &bar) && bar.string.size != 0){
|
||||
// TODO(allen): There should be a way to say, "detach a buffer's file" and "attach this file to a buffer"
|
||||
List_String_Const_u8 new_file_name_list = {};
|
||||
string_list_push(scratch, &new_file_name_list, string_remove_front_of_path(file_name));
|
||||
string_list_push(scratch, &new_file_name_list, bar.string);
|
||||
String_Const_u8 new_file_name = string_list_flatten(scratch, new_file_name_list, StringFill_NullTerminate);
|
||||
if (buffer_save(app, buffer, new_file_name, BufferSave_IgnoreDirtyFlag)){
|
||||
Buffer_ID new_buffer = create_buffer(app, new_file_name, BufferCreate_NeverNew|BufferCreate_JustChangedFile);
|
||||
if (new_buffer != 0 && new_buffer != buffer){
|
||||
delete_file_base(app, file_name, buffer);
|
||||
view_set_buffer(app, view, new_buffer, 0);
|
||||
}
|
||||
// TODO(allen): There should be a way to say, "detach a buffer's file" and "attach this file to a buffer"
|
||||
List_String_Const_u8 new_file_name_list = {};
|
||||
string_list_push(scratch, &new_file_name_list, string_remove_front_of_path(file_name));
|
||||
string_list_push(scratch, &new_file_name_list, bar.string);
|
||||
String_Const_u8 new_file_name = string_list_flatten(scratch, new_file_name_list, StringFill_NullTerminate);
|
||||
if (buffer_save(app, buffer, new_file_name, BufferSave_IgnoreDirtyFlag)){
|
||||
Buffer_ID new_buffer = create_buffer(app, new_file_name, BufferCreate_NeverNew|BufferCreate_JustChangedFile);
|
||||
if (new_buffer != 0 && new_buffer != buffer){
|
||||
delete_file_base(app, file_name, buffer);
|
||||
view_set_buffer(app, view, new_buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3181,7 +3181,7 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
|
|||
Temp_Memory temp = begin_temp(scratch);
|
||||
Keyword_Layout key_layout = opt_key_layout(scratch, keywords);
|
||||
|
||||
fprintf(out, "u64 %.*s_hash_array[%d] = {\n",
|
||||
fprintf(out, "u64 " LANG_NAME_LOWER_STR "_%.*s_hash_array[%d] = {\n",
|
||||
string_expand(keywords.pretty_name), key_layout.slot_count);
|
||||
for (i32 i = 0; i < key_layout.slot_count; i += 1){
|
||||
if (key_layout.slots[i] == 0){
|
||||
|
@ -3198,7 +3198,7 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
|
|||
|
||||
for (i32 i = 0; i < key_layout.slot_count; i += 1){
|
||||
if (key_layout.slots[i] != 0){
|
||||
fprintf(out, "u8 %.*s_key_array_%d[] = {",
|
||||
fprintf(out, "u8 " LANG_NAME_LOWER_STR "_%.*s_key_array_%d[] = {",
|
||||
string_expand(keywords.pretty_name), i);
|
||||
String_Const_u8 lexeme = key_layout.slots[i]->lexeme;
|
||||
for (u64 j = 0; j < lexeme.size; j += 1){
|
||||
|
@ -3208,20 +3208,20 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
|
|||
}
|
||||
}
|
||||
|
||||
fprintf(out, "String_Const_u8 %.*s_key_array[%d] = {\n",
|
||||
fprintf(out, "String_Const_u8 " LANG_NAME_LOWER_STR "_%.*s_key_array[%d] = {\n",
|
||||
string_expand(keywords.pretty_name), key_layout.slot_count);
|
||||
for (i32 i = 0; i < key_layout.slot_count; i += 1){
|
||||
if (key_layout.slots[i] == 0){
|
||||
fprintf(out, "{0, 0},\n");
|
||||
}
|
||||
else{
|
||||
fprintf(out, "{%.*s_key_array_%d, %llu},\n",
|
||||
fprintf(out, "{" LANG_NAME_LOWER_STR "_%.*s_key_array_%d, %llu},\n",
|
||||
string_expand(keywords.pretty_name), i, key_layout.slots[i]->lexeme.size);
|
||||
}
|
||||
}
|
||||
fprintf(out, "};\n");
|
||||
|
||||
fprintf(out, "Lexeme_Table_Value %.*s_value_array[%d] = {\n",
|
||||
fprintf(out, "Lexeme_Table_Value " LANG_NAME_LOWER_STR "_%.*s_value_array[%d] = {\n",
|
||||
string_expand(keywords.pretty_name), key_layout.slot_count);
|
||||
for (i32 i = 0; i < key_layout.slot_count; i += 1){
|
||||
if (key_layout.slots[i] == 0){
|
||||
|
@ -3245,9 +3245,9 @@ gen_keyword_table(Arena *scratch, Token_Kind_Set tokens, Keyword_Set keywords, F
|
|||
}
|
||||
fprintf(out, "};\n");
|
||||
|
||||
fprintf(out, "i32 %.*s_slot_count = %d;\n",
|
||||
fprintf(out, "i32 " LANG_NAME_LOWER_STR "_%.*s_slot_count = %d;\n",
|
||||
string_expand(keywords.pretty_name), key_layout.slot_count);
|
||||
fprintf(out, "u64 %.*s_seed = 0x%016llx;\n",
|
||||
fprintf(out, "u64 " LANG_NAME_LOWER_STR "_%.*s_seed = 0x%016llx;\n",
|
||||
string_expand(keywords.pretty_name), key_layout.seed);
|
||||
|
||||
end_temp(temp);
|
||||
|
@ -3453,8 +3453,12 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set
|
|||
{
|
||||
Keyword_Set *keywords = handler->keywords;
|
||||
fprintf(out, "Lexeme_Table_Lookup lookup = "
|
||||
"lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, "
|
||||
"%.*s_value_array, %.*s_slot_count, %.*s_seed, "
|
||||
"lexeme_table_lookup("
|
||||
LANG_NAME_LOWER_STR "_%.*s_hash_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_key_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_value_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_slot_count, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_seed, "
|
||||
"state.emit_ptr, token.size);\n",
|
||||
string_expand(keywords->pretty_name),
|
||||
string_expand(keywords->pretty_name),
|
||||
|
@ -3477,8 +3481,12 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set
|
|||
{
|
||||
Keyword_Set *keywords = handler->keywords;
|
||||
fprintf(out, "Lexeme_Table_Lookup lookup = "
|
||||
"lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, "
|
||||
"%.*s_value_array, %.*s_slot_count, %.*s_seed, "
|
||||
"lexeme_table_lookup("
|
||||
LANG_NAME_LOWER_STR "_%.*s_hash_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_key_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_value_array, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_slot_count, "
|
||||
LANG_NAME_LOWER_STR "_%.*s_seed, "
|
||||
"state.delim_first, (state.delim_one_past_last - state.delim_first));\n",
|
||||
string_expand(keywords->pretty_name),
|
||||
string_expand(keywords->pretty_name),
|
||||
|
|
Loading…
Reference in New Issue